Easy way to kill processes on remote computer using powershell

by Sitaram Pamarthi on October 1, 2010

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.

This post was written by...

– who has written 499 posts on Techibee.com.

Sitaram Pamarthi is a windows administrators with 9+ years of experience.read more

{ 1 comment… read it below or add one }

Lee Mossolle October 4, 2013 at 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.

Reply

Leave a Comment

Previous post:

Next post: