Skip to content

Instantly share code, notes, and snippets.

@loitho
Created April 16, 2023 16:44
Show Gist options
  • Save loitho/4071e4fb926210a7382740665c1b68f5 to your computer and use it in GitHub Desktop.
Save loitho/4071e4fb926210a7382740665c1b68f5 to your computer and use it in GitHub Desktop.
$counters = @("\Network Interface(*)\Bytes Total/sec","\Network Interface(*)\Packets/sec","\Network Interface(*)\Packets Received Discarded","\Network Interface(*)\Packets Received Errors","\Network Interface(*)\Packets Outbound Discarded","\Network Interface(*)\Packets Outbound Errors")
$timeout = new-timespan -Seconds 10
$sw = [diagnostics.stopwatch]::StartNew()
while ($sw.elapsed -lt $timeout)
{
get-counter -counter $counters | select -expand countersamples | select timestamp,path,instancename,cookedvalue | export-csv -append -notypeinformation "c:\misc\counters.txt"
start-sleep -seconds 2
}
write-host "Finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment