Find processor intensive processes
In order to find
CPU intensive processes, the counter
\Process(*)\% Processor Time
can be used:
(get-counter '\Process(*)\% Processor Time').counterSamples |
sort-object cookedValue -desc |
select-object -first 10
Multiple processes
The
\Process(…)
related counted are indexed by process image name, not by the
process id. Thus, the following command reports only one Powershell process's working set even if multiple Powershell process are running:
(get-counter '\Process(powershell)\Working Set').counterSamples.cookedVAlue / 1mb
In order to get the individual processes's numbers, the process name can be indexed with #0
, #1
etc:
(get-counter '\Process(powershell#0)\Working Set').counterSamples.cookedVAlue / 1mb
(get-counter '\Process(powershell#1)\Working Set').counterSamples.cookedVAlue / 1mb