PowerTip: View Network Statistics with PowerShell

PowerTip: View Network Statistics with PowerShell

  • Comments 2
  • Likes

Summary: Learn how to use Windows PowerShell to view network statistics.

Hey, Scripting Guy! Question How can I use Windows PowerShell to view the amount of data going through my network cards?

Hey, Scripting Guy! Answer 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.) 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Cool Tip

  • I don't find a set called 'Network Adapter' but do find one called 'Network Interface.'