Here is a simple script to display information about the guest OS of a running virtual machine:
dim vs, vm
Set vs = CreateObject(“VirtualServer.Application”)
set vm = vs.FindVirtualMachine(“a virtual machine”)
‘Display information about the GuestOS
wscript.echo “Guest OS Information:”
wscript.echo “OSName : ” & vm.GuestOS.OSName
wscript.echo “AdditionsVersion : ” & vm.GuestOS.AdditionsVersion
wscript.echo “CanShutdown : ” & vm.GuestOS.CanShutdown
wscript.echo “IsHeartbeating : ” & vm.GuestOS.IsHeartbeating
wscript.echo “HeartbeatPercentage : ” & vm.GuestOS.HeartbeatPercentage
wscript.echo “IsHostTimeSyncEnabled : ” & vm.GuestOS.IsHostTimeSyncEnabled
As you can see it displays the guest OS name (e.g. Windows XP), the version of Virtual Machine Additions that is installed, whether the guest operating system can be shut down remotely, if a heartbeat is being reported (and if so how many heartbeats have been received) and finally if host time synchronization is enabled.
All of this information can only be accessed if the virtual machine is currently running, and has Virtual Machine Additions installed. If you try to run the script on a virtual machine that is not running, or does not have Virtual Machine Additions installed, you will receive an exception error.