Cloud Security, Privacy and Reliability...

Security, Community and a whole lot more!


Scripting starting a network under Virtual Server

  • Comments 2
  • Likes

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:

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:

'script starts

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 arguments
'vsHost = WScript.Arguments(2)
vsHost = "localhost"

' Connect to Virtual Server
Set virtualServer = CreateObject("VirtualServer.Application",vsHost)

' Create virtual machine objects
Set vm1 = virtualServer.FindVirtualMachine(vmName1)
Set vm2 = virtualServer.FindVirtualMachine(vmName2)

'Start first virtual machine

'Ignore errors 
On Error Resume Next

'Loop until vm1 returns a heartbeat
while not vm1.GuestOS.IsHeartbeating
 wscript.sleep 500

'Listen to error messages again
On Error GoTo 0

'Start second virtual machine

'Script ends


  • In your presentation on Oct 17/05 you showed several VB scripts. Can you make they available. Thanks.

  • Bruce:

    Could you please publish on this blog your Oct.17, 2005 presentation with VM2005 scripts?

    Thank you!

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment