Search code examples
powershellperformancecounterperfmon

Is it possible to get performance counter description using Powershell command get-counter?


On Windows, we can easily get the description of a performance counter by using the perfmon utility. Take a look at the description section in below snapshot.

enter image description here

Is it possible to get this info from Powershell's get-counter cmdlet?


Solution

  • It appears that information is stored in the registry at (for English):

    HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009 in the multi-string key Help

    So since PowerShell can use the Registry as a Provider, yes you can get this information technically although it's a bit ugly:

    (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009").Help
    

    That will pull all the text from the help entry, which you can then filter through with pipes/Select-String/various string methods, Where clauses/etc.