Virtualization Technology News and Information
Article
RSS
Need to get your virtual machine's uptime?
Let's face it, you are designing an application or writing a script against your virtual server host machine and need to pull out some important information about the host server or its virtual machines but you don't know how to go about getting it.  Happens all the time and to the best of us.  Good thing we have people like Ben Armstrong to keep us all in the know.  Ben comes through again with a great way to programmatically grab a virtual machine's uptime information from Virtual Server.

Virtual Server 2005 R2 provides a set of statistical information about its virtual machines through the VMAccountant object.  Ben provides a simple script that will go through all virtual machines on a physical server and display how long the VMs have been running as reported by the accountant object.  NOTE, the values are reported in seconds.


Set vs = CreateObject("VirtualServer.Application")
set vms = vs.VirtualMachines

For Each vm in vms
    Wscript.Echo "Virtual machine: " & vm.Name
    Wscript.Echo "Uptime: " & vm.Accountant.Uptime
    Wscript.Echo
Next

Read Ben's original post on his site, here, and feel free to thank him or comment on his solution.
Published Sunday, April 09, 2006 11:10 AM by David Marshall
Filed under:
Comments
There are no comments for this post.
To post a comment, you must be a registered user. Registration is free and easy! Sign up now!
Calendar
<April 2006>
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456