Created
January 29, 2012 00:37
-
-
Save abarnas/1696441 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set colConfs = objWMI.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True") | |
For Each objConf in colConfs | |
strAdapterName = GetAdapterName(objConf.Caption) | |
strIPAddress = GetMultiString_FromArray(objConf.IPAddress, ", ") | |
Set colNetAdapters = objWMI.ExecQuery("Select * From Win32_NetworkAdapter WHERE Caption = '" & objConf.Caption & "'") | |
For Each objAdapter In colNetAdapters | |
WScript.Echo "Adding monitor for network connection: " & objAdapter.NetConnectionID | |
'Bandwidth and Bytes | |
Column = 1 | |
MonitorName = "Bytes+Throughput:+" & Replace(objAdapter.NetConnectionID, " ", "+") | |
monitorParams = "Bandwidth:Bytes+Throughput:Bytes+Throughput:3:false;" | |
resultParams = "BytesReceivedPerSec:Received/Sec:N%2FA:2;BytesSentPerSec:Sent/Sec:N%2FA:2;BytesTotalPerSec:Total/Sec:N%2FA:2;" | |
AddCustMon | |
'Packets/Sec | |
Column = 2 | |
MonitorName = "Packets:+" & Replace(objAdapter.NetConnectionID, " ", "+") | |
monitorParams = "PacketsPerSec:Packets:Packets/Sec:3:false;" | |
resultParams = "PacketsReceivedPerSec:Received/Sec:N%2FA:2;PacketsSentPerSec:Sent/Sec:N%2FA:2;TotalPacketsPerSec:Packets/Sec:N%2FA:2;PacketsReceivedDiscarded:Discarded:N%2FA:2;PacketsReceivedError:Error:N%2FA:2;" | |
AddCustMon | |
'Make sure we add the monitor on the correct row and column | |
Row = Row + 1 | |
Next | |
Next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment