Tech: Gathering network statistics from Microsoft Virtual Server 2005

Ben Armstrong published another script in his endless serie, this time aimed to gather informations about Virtual Server 2005 virtual networks:

Set vs = CreateObject(“VirtualServer.Application”)

For Each vn in vs.VirtualNetworks
Wscript.Echo
Wscript.Echo “Virtual Network: ” & vn.name
Wscript.Echo “Packets sent: ” & vn.packetsSent
Wscript.Echo “Packets received: ” & vn.packetsReceived
Wscript.Echo
Next

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

Update: Ben posted a little modification of the above script to collect historical statistics.

This script below will go through each virtual network on a physical computer and enumerate the amount of traffic seen each second for the last 60 seconds:

Set vs = CreateObject(“VirtualServer.Application”)

For Each vn in vs.VirtualNetworks
Wscript.Echo
Wscript.Echo “Virtual Network: ” & vn.name

Wscript.Echo
Wscript.Echo “Packets sent history: ”
For Each stat in vn.PacketsSentHistory
Wscript.StdOut.Write stat
Wscript.StdOut.Write “,”
Next

Wscript.Echo
Wscript.Echo “Packets received history: ”
For Each stat in vn.PacketsReceivedHistory
Wscript.StdOut.Write stat
Wscript.StdOut.Write “,”
Next
Wscript.Echo
Next

Also in this case be sure to read the original post for updates and comments.