Powershell - Get CPU Usage by Process (remote)

   · β˜• 1 min read
🏷️
  • #powershell
  • You would expect Get-Process to do the job, but it turns out that its CPU metric is not on a 0..100% scale.

    Here is a one-liner (find who's eating into your CPU - or that of a remote server):

    1
    
    gwmi Win32_PerfFormattedData_PerfProc_Process -filter "Name <> '_Total' and Name <> 'Idle'" -Computer $servername | where { $_.PercentProcessorTime -gt 0 } | select Name, PercentProcessorTime
    

    For some reason, the total percentage of all selected processes can be greater than 100, I'm guessing there was a measurement lag. Don't forget to initialize $servername (or hard code it before executing).

    Credit goes here.


    Victor Zakharov
    WRITTEN BY
    Victor Zakharov
    Web Developer (Angular/.NET)