Have you ever wished you could remotely kill a task on a computer? Your wish is about to come true. You’re probably regretting that you didn’t wish for something better. Like wings.

This will work on all versions of Microsoft Windows (at least all the supported ones).

There are two commands that you will use. TASKLIST and TASKKILL.

Let’s assume that the remote computer is named “BENJI-PC”. To get a list of the running processes type:

TASKLIST /s BENJI-PC

Make sure you use the correct name of your remote computer or you’ll be disappointed with the results. You will get a list of all the running processes that looks something like this:

tasklistlocal

To kill a specific process, find something you want to end and note the number in the PID column. I’m going to kill “regedit” (highlighted above), so I would use TASKKILL like this:

TASKKILL /s BENJI-PC /PID 34164

I receive the following message:

taskkilllocal

You can also end the task based on the process name, which will target all tasks with that image name. For example, to target all Chrome tasks on BENJI-PC you could use the following:

TASKKILL /s BENJI-PC /IM chrome.exe

Note: For all these commands we assume that you have access to the computer you are killing the process on. If you need to specify a different username and password, then add /U and /P to the switches:

TASKLIST /S computer /U domain\username /P password

TASKKILL /S computer /U domain\username /P password /PID 1234

You can also specify multiple PIDs:

TASKKILL /PID 123 /PID 456 /PID 789

And wildcards!:

TASKKILL /s BENJI-PC /IM chrom*

Of course, you can always get more options by using TASKLIST /? and TASKKILL /?. Duh.

 

 

Comments

  1. Peter Barnett

    It might be beneficial to bundle this with PowerShell to add an ability to search process by name, not by process id.

    For example search for Dropbox.exe process id:
    Get-WmiObject -Class Win32_Process -Computer RemoteComputerName | Select-Object Name, ProcessId | Where-Object -FilterScript {$_.Name -like “Dropbox.exe”}

    Or search for the same exe on all computers in an AD domain:
    Get-ADComputer | ForEach-Object {Get-WmiObject -Class Win32_Process -Computer RemoteComputerName | Select-Object Name, ProcessId | Where-Object -FilterScript {$_.Name -like “Dropbox.exe”}}

    You can easily add taskkill as shown in this article to kill process by name on all computers in an AD domain.

    Here is more detailed syntax on how to search/filter processes on remote computers: https://www.action1.com/kb/list_of_running_processes_on_remote_computer.html

Leave a Reply

Your email address will not be published. Required fields are marked *