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 503 posts on Techibee.com.

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

{ 6 comments… read them below or add one }

Leave a Comment

{ 1 trackback }

Previous post:

Next post: