Skip to content

Instantly share code, notes, and snippets.

@aroben
Last active December 17, 2015 04:19
Show Gist options
  • Save aroben/5550040 to your computer and use it in GitHub Desktop.
Save aroben/5550040 to your computer and use it in GitHub Desktop.
Script to measure network usage on Windows
$LastLine = ""
while ($true) {
$Bps = Get-WMIObject -Class Win32_PerfFormattedData_Tcpip_NetworkInterface `
| Measure-Object BytesTotalPersec -Sum | %{ $_.Sum }
$ThisLine = "{0:F2} KiB/sec" -f ($Bps / 1024)
[Console]::Write("`r{0}" -f (" " * $LastLine.Length))
[Console]::Write("`r$ThisLine")
$LastLine = $ThisLine
Start-Sleep -Seconds 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment