Home > PowerShell > Easy way to kill processes on remote computer using powershell

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. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>