Virtualization Technology News and Information
Article
RSS
CODE: Virtual Server Network Statistics from WMI

Thanks to Ben Armstrong for great code post on his Web site, Virtual PC Guy's Weblog:

Ben writes:

Continuing with my journey through the undocumented lands of Virtual Server WMI we come to virtual network statistics.  This nice little script displays information about virtual network name, and the number of packets and bytes that have been sent received and dropped on each virtual network:

Option Explicit

Dim vsWMI, vns, vn

Set vsWMI = GetObject("winmgmts:\\.\root\vm\virtualserver")
Set vns = vsWMI.ExecQuery( "SELECT * FROM VirtualNetwork",,48)
For Each vn in vns
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "Virtual Network: " & vn.Name
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "Packets Sent: " & vn.PacketsSent & _
   " (" & vn.BytesSent & " bytes)"
    Wscript.Echo "Packets Received: " & vn.PacketsReceived & _
   " (" & vn.BytesReceived & " bytes)"
    Wscript.Echo "Packets Dropped: " & vn.PacketsDropped & _
   " (" & vn.BytesDropped & " bytes)"
Next

One oddity about the WMI interface here is that you will only see information about virtual network for which there is a currently running virtual machine connected.

Thank Ben by commenting on his original post on his Website, here.

Published Tuesday, October 03, 2006 7:14 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!
top25
Calendar
<October 2006>
SuMoTuWeThFrSa
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234