Summary: Learn how to use Windows PowerShell to view network statistics.
How can I use Windows PowerShell to view the amount of data going through my network cards?
One way is to use the performance counters.
To find available counters:
Get-Counter -ListSet ‘Network Adapter’ | select -ExpandProperty PathsWithInstances | sort
To view the statistics for a particular card:
$test = Get-Counter -Counter “Network Adapter(Qualcomm Atheros AR5007 802.11b_g WiFi Adapter)Bytes Total/sec” -MaxSamples 30
(This records thirty seconds of data by using the default sampling interval.)
To get the total traffic, use Measure-Object:
$test.CounterSamples | measure cookedvalue –Sum
(The –Sum property of the output holds the traffic level.)
0 comments