≡ Menu

Accessing performance counters using PowerShell

Using Get-Counter cmdlet in PowerShell V2, you can get performance counter values. For instance, if you want the current free memory statistics, use this command.

Get-Counter ‘MemoryAvailable MBytes’

If you want to query the counter continously, use below command.

Get-Counter ‘MemoryAvailable MBytes’ -Continous -SampleInterval 5

Here sampleinterval means how frequently you want to query the performance counter. You can need to parse a value in seconds for this.

Looks like cool right? You can do this from command prompt without powershell also, see my previous post.

Happy Learning..,
Sitaram Pamarthi