≡ Menu

Easy way to kill processes on remote computer using powershell

I earlier authored http://techibee.com/powershell/kill-a-process-on-remote-machine-using-powershell-remoting/262 to demostrate how to kill a process on remote computer. Today when my colleague asked for it, I revisited this article again and felt we can do in much better and easy way.

Say if the computers are in a text file called comps.txt, the script follows like this.

$comps = Get-content c:tempcomps.txt

foreach ($comp in $comps) {

invoke-command -computer $comp { get-process notepad | stop-process -force}

}

In this example I am killing notepad process. You can replace the name with process you want to kill on remote computer.

{ 1 comment… add one }

  • Lee Mossolle October 4, 2013, 1:41 am

    How can this close an application for the current user only? We have several users connected to the server and would like to only kill the app for the current user.

Leave a Comment