How to get the Process performance counter using PowerShell?


To get all the process-related counters, you need to use the below command.

Example

Get-Counter -ListSet "*Processor*" | Select CounterSetName

Output

CounterSetName
--------------
Processor Information
Per Processor Network Activity Cycles
Per Processor Network Interface Card Activity
Hyper-V Worker Virtual Processor
Hyper-V Hypervisor Virtual Processor
Hyper-V Hypervisor Root Virtual Processor
Hyper-V Hypervisor Logical Processor
Processor
Processor Performance

Now let say we need the Processor Performance counter set then we can use the below command to retrieve all its counters.

PS C:\> Get-Counter -ListSet "Processor Performance" | Select -ExpandProperty Counter
\Processor Performance(*)\Processor Frequency
\Processor Performance(*)\% of Maximum Frequency
\Processor Performance(*)\Processor State Flags

Let assume we need the processor maximum frequency counter among this then,

Example

Get-Counter -Counter '\Processor Performance(*)\% of Maximum Frequency'

Output

To run the performance counter continuously use,

Example

Get-Counter -Counter '\Processor Performance(*)\% of Maximum Frequency' -Continuous

To retrieve the specific number of samples for the specific intervals,

Example

Get-Counter -Counter '\Processor Performance(*)\% of Maximum Frequency' -SampleInterval 2 -MaxSamples 3

Updated on: 12-Apr-2021

359 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements