Scripting automatic startup for virtual machines under Virtual Server

Virtual Server allows you to configure virtual machines to startup automatically when the host system boots.  However in order to enable this feature you need to configure a user account to run the virtual machine under first (as when the host system boots there is no available user session to run the virtual machine under).  Below is a script that will configure a virtual machine to start automatically when the host system boots – if it was running when the host system shutdown:

Set objVS = CreateObject(“VirtualServer.Application”)
Set objVM = objVS.FindVirtualMachine(“VM Name”)
objVM.RunAsDefinedAccount = True
result = objVM.SetAccountNameAndPassword(“DOMAINUsername”,”Password”)
objVM.AutoStartAtLaunch = 2

If you want the virtual machine to always start (whether it was running before or not) you should set AutoStartAtLaunch to 1.

Cheers,
Ben