Kill a process on remote machine using PowerShell Remoting

by Sitaram Pamarthi on January 22, 2010

In this post I will explain you how to kill a sample process on remote machine using PowerShell remoting(read my previous articles in poweshell category if you want to know more about powershell remoting). I am going to kill the process, wordpad.exe on remote machine CompB using below steps.

Establish a remote session:

$remote = New-PSSession -ComputerName CompB

Bring remote commands to local session(what the heck is this?.. see powershell blog)

Import-PSSession -Session $remote -CommandName *-Process -Prefix Remote

Verify if that process exists on remote machine

Get-RemoteProcess -Name wordpad.exe

If exists, kill it..

Get-RemoteProcess -Name wordpad.exe | stop-RemoteProcess

Hmm..Check that process is terminated on remote machine.

Happy Learning..,
Sitaram Pamarthi

This post was written by...

– who has written 502 posts on

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

{ 6 comments… read them below or add one }

Carl Wayne April 21, 2011 at 2:59 am

Import-PSSession -Session $remote -CommandName *-Process -Prefix Remote
gives me many lines of error…


Sitaram Pamarthi April 22, 2011 at 9:16 pm

Carl, Verify that the remote computer has PowerShell Remoting enabled.
See my post about managing remoting feature in PS( Post the error if it continues to occur


Sitaram Pamarthi April 22, 2011 at 9:18 pm

Also refer for enabling remoting on remote computer to which you are trying to connect


Daryl September 13, 2011 at 12:46 pm

Keep in mind this doesn’t work without an PSSession on the remote machine. There is however a way to kill remote processes without creating a PSSessions. I just wrote an article about it on my blog:


Daryl September 13, 2011 at 12:47 pm
Sitaram Pamarthi September 13, 2011 at 9:53 pm

Daryl, The link you have appended is not working. However, I guess you are using WMI to terminate a process which works fine for both XP(without PS v2) and Windows 7 environments. But if your environment is completely running with powershell V2, then I would suggest using PS remoting as it has it’s own advantages.


Leave a Comment

{ 1 trackback }

Previous post:

Next post: