Gathering virtual machine uptime information from Virtual Server

Gathering virtual machine uptime information from Virtual Server

  • Comments 3

Virtual Server 2005 R2 provides an interesting set of statistical information about virtual machines through the VMAccountant object.  Below is a simple script that will go through all virtual machines on a physical computer and display the information about how long they have been running as reported by their accountant objects:

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

Note that the uptime information is reported in seconds.

Cheers,
Ben

Leave a Comment
  • Please add 2 and 1 and type the answer here:
  • Post
  • That's really great but better will be one function that returns the idle time of one Virtual Machine Guest. With this we can use Host resources even more efficiently. There's any way to accomplish that?
  • That's really great but better will be one function that returns the idle time of one Virtual Machine Guest. With this we can use Host resources even more efficiently. There's any way to accomplish that?

    Thanks,
  • Checkout:

    http://blogs.msdn.com/virtual_pc_guy/archive/2006/02/23/534838.aspx

    Cheers,
    Ben
Page 1 of 1 (3 items)