I have had quite a number of people asking me how you script a start up order for virtual machines under Virtual Server 2005. A good example of this is to make sure your DC is online before your Exchange Server starts up. There are a few ways you can do this...
Ben Armstrong has provided a couple of solutions on his blog: http://blogs.msdn.com/virtual_pc_guy/archive/2005/09/29/473898.aspx
I have re-written this one to work with the scripts I have been posting recently...
In this solution we will us the heartbeat function to see when the machine is online:
On Error Resume Next
'This script is designed to start up the first Virtual Machine (vmname1) and wait until we get a heartbeat (i.e. it is online) before starting the second machine.'There are 3 parameters: vmName1, vmName2 and vmHost
' Get / Set argumentsvmName1=WScript.Arguments(0)vmname2=WScript.Arguments(1)'vsHost = WScript.Arguments(2)vsHost = "localhost"
' Connect to Virtual ServerSet virtualServer = CreateObject("VirtualServer.Application",vsHost)
' Create virtual machine objectsSet vm1 = virtualServer.FindVirtualMachine(vmName1)Set vm2 = virtualServer.FindVirtualMachine(vmName2)
'Start first virtual machinevm1.startup
'Ignore errors On Error Resume Next
'Loop until vm1 returns a heartbeatwhile not vm1.GuestOS.IsHeartbeating wscript.sleep 500wend
'Listen to error messages againOn Error GoTo 0
'Start second virtual machinevm2.startup
In your presentation on Oct 17/05 you showed several VB scripts. Can you make they available. Thanks.
Could you please publish on this blog your Oct.17, 2005 presentation with VM2005 scripts?