Managing remote processes with Powershell

This is to manage remote processes on a server that is not allowing you to log in due to high CPU on a process.

Invoke-Command servername {Get-Process}
Example to look for chrome processes
Invoke-Command servername {Get-Process chrome}

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ComputerName
------- ------ ----- ----- ----- ------ -- ----------- ------------
    254     39  93252 104076  852    12.97  21204 chrome servername
    238     24  38156  49512  759     1.17  21380 chrome servername
    223     20  23184  27044  731     0.25  22012 chrome servername
    399     48  87928 112292  382    11.02  22444 chrome servername
    544     80 293940 328044 1137 34509.08  22576 chrome servername

The last line with the large number for CPU is the cause of the issue.

This command will kill the offending process with ID 22576

Invoke-Command servername {Stop-Process -ID 22576 -Force}

This command will kill all chrome processes

Invoke-Command servername {Get-Process chrome | Stop-Process -Force}

After that the server was responsive again.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s