Get-WmiObject win32_processor -ComputerName $computer | Measure-Object -property LoadPercentage -Average |
Select @{Label = "Computer"; Expression = {$computer}},@{Label = "CpuUsage"; Expression = {$_.Average}}
Returns the total percentage of process ultization on your local or remote system.
PS C:\> $computer = 'localhost' >> Get-WmiObject win32_processor -ComputerName $computer | Measure-Object -property LoadPercentage -Average | >> Select @{Label = "Computer"; Expression = {$computer}},@{Label = "CpuUsage"; Expression = {$_.Average}} Computer CpuUsage -------- -------- localhost 15