Contact

Subscribe via Email

Subscribe via RSS/JSON

Categories

Recent Posts

Creative Commons Attribution 4.0 International License
© Rakhesh Sasidharan

Elsewhere

Killing a process on a remote computer using PowerShell

Killing a process on a local computer is easy.

Or:

Or:

You get the idea …

But neither of these work on a remote computer!

The stop-process cmdlet doesn’t support the -ComputerName switch, so the second method doesn’t even work remotely. The third method fails with an error Stop-Process : Feature is not supported for remote machines and the first method fails with an error Exception calling "Kill" with "0" argument(s): "Feature is not supported for remote machines.".

So it’s back to our old friend WMI for killing processes on remote computers. The objects returned via WMI contain a Terminate method which we can make use of:

The snippet above terminates all processes with the name “notepad” on the remote computer “mango”.

If you are curious about what other methods are available when dealing with the Process class using WMI, do the following:

Killing a process on a remote computer using PowerShell by rakhesh is licensed under a Creative Commons Attribution 4.0 International License.