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