PowerShell: CPU usage remote pc

Use the powershell command below to get the list of processes on a remote Windows computer, sorted by CPU usage.

$remoteComputerName = "rdwevw25"
$session = New-PSSession -ComputerName $remoteComputerName
$scriptBlock = {
   Get-Process | Sort-Object -Property cpu -Descending

}

$result = Invoke-Command -Session $session -ScriptBlock $scriptBlock
Remove-PSSession -Session $session

$result
Share your love