Use PowerShell to display network statistics over time

by Mitch Tulloch [Published on 5 March 2014 / Last Updated on 5 March 2014]

A tip on how to use PowerShell to view network statistics over time

Here's a tip from my colleague Ed Wilson (the Microsoft Scripting Guy) about how to use PowerShell to display network statistics over time.

Question: How can you use Windows PowerShell to display network statics over time for your review?

Answer: Create an array and then pipe the commands to the Foreach-Object cmdlet (% is an alias). Call the Get-NetAdapterStatistics inside the loop, and pipe the results to the Out-GridView cmdlet (ogv is an alias). Control the amount of time between captures by changing the value of the sleep command. The command appears here:

1..2 | % {Get-NetAdapterStatistics -Name *external* | select ReceivedBytes, SentBytes; sleep 5} | ogv

Mitch Tulloch is a nine-time recipient of the Microsoft Most Valuable Professional (MVP) award and a widely recognized expert on Windows administration, deployment and virtualization.  For more information see

Ed Wilson is the bestselling author of eight books about Windows Scripting, including Windows PowerShell 3.0 Step by Step, and Windows PowerShell 3.0 First Steps. He writes a daily blog about Windows PowerShell call Hey, Scripting Guy! that is hosted on the Microsoft TechNet Script Center; for more PowerTips check out the Hey, Scripting Guy! blog.

Featured Links