Welcome to MSDN Blogs Sign in | Join | Help

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("DOMAIN\Username","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

Published Thursday, March 16, 2006 8:35 PM by Virtual PC Guy

Comments

Tuesday, April 11, 2006 10:46 AM by MadMax

# re: Scripting automatic startup for virtual machines under Virtual Server

Excellent, but how do I use it Virtualguy?

Thanks
New Comments to this post are disabled
 
Page view tracker