Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Perfmon Counter Provider
Import-Module simplex
New-PSDrive perf -PSProvider simplex -root "C:\Scripts\PerfmonCountersDrive.ps1"
cd 'perf:\Counters\.NET CLR Data'
dir | select -expand paths
\.NET CLR Data(*)\SqlClient: Current # pooled and nonpooled connections
\.NET CLR Data(*)\SqlClient: Current # pooled connections
\.NET CLR Data(*)\SqlClient: Current # connection pools
\.NET CLR Data(*)\SqlClient: Peak # pooled connections
\.NET CLR Data(*)\SqlClient: Total # failed connects
\.NET CLR Data(*)\SqlClient: Total # failed commands
dir .\Processor | Get-Counter | Select -expand CounterSamples | ? InstanceName -eq '_total' | ft -AutoSize
Path InstanceName CookedValue
---- ------------ -----------
\\chunt\processor(_total)\% processor time _total 2.20832835820896
\\chunt\processor(_total)\% user time _total 1.35821890547264
\\chunt\processor(_total)\% privileged time _total 0.970149253731343
\\chunt\processor(_total)\interrupts/sec _total 6429.09274985706
\\chunt\processor(_total)\% dpc time _total 0
\\chunt\processor(_total)\% interrupt time _total 0
\\chunt\processor(_total)\dpcs queued/sec _total 866.239847045942
\\chunt\processor(_total)\dpc rate _total 11
\\chunt\processor(_total)\% idle time _total 98.5678009950249
\\chunt\processor(_total)\% c1 time _total 0.38036815920398
\\chunt\processor(_total)\% c2 time _total 0
\\chunt\processor(_total)\% c3 time _total 94.9976517412935
\\chunt\processor(_total)\c1 transitions/sec _total 59.7406791066167
\\chunt\processor(_total)\c2 transitions/sec _total 0
\\chunt\processor(_total)\c3 transitions/sec _total 8879.45627121346
root {
Get-Counter -ListSet * | Select-Object -ExpandProperty CounterSetName | foreach-object {
$content = $_;
script $content {
Get-Counter -ListSet $content

This comment has been minimized.

Copy link
Owner Author

cdhunt commented Jul 30, 2014

Now 8 lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.