Get current CPU utilization percentage

Hi, All.

I have been trying to get the percentage of CPU utilization through PowerShell for a few days. I have tried several different methods available from my research, but I can’t find a way to get the current percentage of CPU utilization for a remote system.

It either returns the CookedValues or the percent from each socket, or just gibberish. Is there a way to get the utilization from a remote server, like what you’d see in Taskmanager, through PowerShell? LIke in this screenshot?


I just found this:

get-ciminstance -ComputerName server1 -class win32_processor |measure -Property LoadPercentage -average | select Average

It doesn’t seem to match exactly the CPU % when viewing Taskmanager and running the cmdlet, but I don’t know if that is connection latency and the returned value is correct for the small blip of time. Is this what will give me what I’m looking for?


LoadPercentage is an appropriate way handle this and I do believe it is a point in time stat which under the hood is polling from the win32 API performance data. You can also tap into the performance data directly from Powershell with Get-Counter but you’d probably have to do some math to if you want more accurate readings.

This is not confirmed, but I believe task manager does a lot of sampling and averaging under the hood to smooth out the usage, but in reality the CPU utilization like would be very jagged

Thanks, Neemobeer.

I agree that there are likely multiple samplings happening to get the current CPU percentage. And I really do just need a point in time report. This will be paired with current memory and running processes to give a high-level from a remote system where some process has gone rogue from a memory leak, etc…

Share what you actually tried next time :slight_smile: . Get-Counter seems to be the play here. Have you tried to use it? I haven’t personally but some googling around seems like it’s been suggested on other forums etc.

Also regarding your concern of something not matching task manager - IIRC task manager isn’t all that accurate anyway. I know there’s ben posts about bugs in win11, but historically I feel like I’ve seen several people complain about it over the years. Take that with a grain of salt, but I’ve always viewed it as a ‘close enough’, but more to my point, I would not be concerned if whatever method you use is off a little bit from what task manager shows. My stream deck and task manager never are the same, always a difference, and sometimes more than seems reasonable, but I attribute that to timing differences etc.