Created
February 19, 2026 07:22
-
-
Save adi928/c9b1d06637eed06e9f7f19fc91620ae7 to your computer and use it in GitHub Desktop.
Simple script to determine top processes consuming cpu.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while($true) { | |
| Clear-Host | |
| Write-Host "--- TOP 15 PROCESSES (CPU USAGE) ---" -ForegroundColor Cyan | |
| Get-Process | Sort-Object CPU -Descending | Select-Object -First 15 -Property Name, Id, @{Name="CPU(s)";Expression={$_.CPU}}, @{Name="RAM(MB)";Expression={[math]::Round($_.WorkingSet / 1MB, 2)}} | Format-Table -AutoSize | |
| Write-Host "`n--- ACTIVE NETWORK CONNECTIONS ---" -ForegroundColor Yellow | |
| Get-NetTCPConnection -State Established | Select-Object LocalAddress, LocalPort, RemoteAddress, RemotePort, | |
| @{Name="Process";Expression={(Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue).Name}}, | |
| @{Name="PID";Expression={$_.OwningProcess}} | Select-Object -First 10 | Format-Table -AutoSize | |
| Write-Host "`n[Press Ctrl+C to Exit] - Refreshing every 3 seconds..." -ForegroundColor Gray | |
| Start-Sleep -Seconds 3 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment