Gathering network statistics under Virtual Server

Last week I showed how to use the VM Accountant object in order to retrieve information about virtual machine uptime.  Today I have a simple script that uses the VM Accountant in order to display information about how much network traffic the virtual machines have received and sent:

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

For Each vm in vms
        Wscript.Echo “Virtual machine: ” & vm.Name
        Wscript.Echo “Network bytes sent: ” & vm.Accountant.NetworkBytesSent
        Wscript.Echo “Network bytes received: ” & vm.Accountant.NetworkBytesReceived