Skip to content

Instantly share code, notes, and snippets.

@royashbrook
Created April 2, 2018 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save royashbrook/ddefc527ba3f403473360beefe5288f0 to your computer and use it in GitHub Desktop.
Save royashbrook/ddefc527ba3f403473360beefe5288f0 to your computer and use it in GitHub Desktop.
$a = "server"
$b = "\Processor(_Total)\% Processor Time"
Get-Counter -com $a -cou $b -s 1 -con | %{
$cv = [math]::round($_[0].CounterSamples.CookedValue)
Write-Progress -Activity $a `
-PercentComplete $cv `
-CurrentOperation "$b - $cv%" `
-Status "Measuring..."
}
#or
$a = "server"
$b = "\Memory\Committed Bytes"
Get-Counter -com $a -cou $b -s 1 -con | %{
$cv = [math]::round($_[0].CounterSamples.CookedValue/1024/1024/1024,4)
Write-Progress -Activity $a `
-PercentComplete $cv `
-CurrentOperation "$b - $cv GB" `
-Status "Measuring..."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment