Celeb Glow
news | March 05, 2026

Get CPU for process in powershell

I want to get the value that is shown in task manager for any process in the CPU column in powershell.

I tried using

Get-Process ProcessName | Select-Object -Property CPU

but it only returns the time spent.

1

3 Answers

Try using the Get-Counter command which pulls the data from the system's performance monitor. For your example, it would look like this:

# ~> Get-Counter "\Process(ProcessName*)\% Processor Time" | select -expand countersamples 

An example, using chrome:

# ~> Get-Counter "\Process(chrome*)\% Processor Time" | select -expand countersamples
Path InstanceName CookedValue
---- ------------ -----------
\\machinename\process(chrome#7)\% processor time chrome 0
\\machinename\process(chrome#6)\% processor time chrome 0
\\machinename\process(chrome#5)\% processor time chrome 0
\\machinename\process(chrome#4)\% processor time chrome 0
\\machinename\process(chrome#3)\% processor time chrome 0
\\machinename\process(chrome#2)\% processor time chrome 0
\\machinename\process(chrome#1)\% processor time chrome 0
\\machinename\process(chrome)\% processor time chrome 3.10141153081511
2

Here are some copy-pastable examples of filtering processes with Get-Counter and Get-WmiObject.

For example, to get the top 10 processes by CPU usage:

powershell "(Get-Counter '\Process(*)\% Processor Time').Countersamples | Sort cookedvalue -Desc| Select -First 10 instancename, cookedvalue"

Or, with cleaner formatting:

powershell "(Get-Counter '\Process(*)\% Processor Time').Countersamples | Sort cookedvalue -Desc | Select -First 10 instancename, @{Name='CPU %';Expr={[Math]::Round($_.CookedValue)}}"


powershell "gwmi Win32_PerfFormattedData_PerfProc_Process | Sort PercentProcessorTime -desc | Select -first 7 Name, PercentProcessorTime, IOReadBytesPersec, IOWriteBytesPersec, WorkingSet | ft -autoformat"

The simpler way I would go on achieving this is

get-process processName | where-object {$_.cpu -gt desirevalue}
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy