Tech: Monitoring virtual machines disk usage with WMI in Virtual Server 2005

Ben Armstrong published another useful WMI script. This one is aimed to control usage of virtual machines virtual disks at host level, in a Microsoft Virtual Server 2005 R2 environment:

Set vsWMIObj = GetObject(“winmgmts:\\.\root\vm\virtualserver”)
Set vms = vsWMIObj.ExecQuery(“SELECT * FROM VirtualMachine”,,48)
For Each vm in vms
Wscript.Echo “==============================================”
Wscript.Echo “Virtual machine: ” & vm.Name
Wscript.Echo “MiB read from disk: ” & vm.DiskBytesRead / 1048576
Wscript.Echo “MiB written to disk: ” & vm.DiskBytesWritten / 1048576
Next

Be sure to read the original post for updates and comments.