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.
Say if the computers are in a text file called comps.txt, the script follows like this.
$comps = Get-content c:tempcomps.txtIn this example I am killing notepad process. You can replace the name with process you want to kill on remote computer.
foreach ($comp in $comps) {
invoke-command -computer $comp { get-process notepad | stop-process -force}
}
Post a Comment
Post a Comment