need to find which process using more CPU on remote computer

Welcome Forums General PowerShell Q&A need to find which process using more CPU on remote computer

Viewing 1 reply thread
  • Author
    Posts
    • #225033
      Participant
      Topics: 1
      Replies: 0
      Points: -7
      Rank: Member

      need to find which process using is consuming more CPU on remote computer including whole CPU usage of server.

      i have tried below script, it give process wise of cpu usage, including this i would require whole cpu consumption of the server, like Task manager in windows.

      $servers = Get-Content c:\temp\servers.txt
      $ErrorActionPreference = 'silentlycontinue'
      
      foreach ($server in $servers)
      
      {
      try{
      
      Invoke-Command -scriptblock {Get-Process | Sort CPU -descending | Select -first 5 } -computername $servers
      
      }
      
      catch{
      Write-Warning "System Not reachable:$server"
      }
      }
      
      • This topic was modified 3 weeks, 1 day ago by kvprasoon. Reason: code formating
    • #225282
      Senior Moderator
      Topics: 8
      Replies: 1215
      Points: 4,334
      Helping Hand
      Rank: Community Hero

      You can sum up CPU usage by all the process using Measure-Command cmdlet.

      Get-Process | Sort CPU -descending | Measure-Command -Property CPU -Sum
      
Viewing 1 reply thread
  • You must be logged in to reply to this topic.