A few days ago I was faced with the issue of Task Manager not responding…so how would I kill tasks…or, how do I kill Task Manager?
Not too many people know about taskkill, the command prompt’s End Task equivalent.
In my particular case I used:
taskkill /f /im Taskmgr.exe
If you are unsure of the Image Name, you can specify a wildcard in the syntax, ex. Task*. The Process ID can also be used. It can be found through Perfmon (Windows 2008) if Task Manager is unresponsive. Go to Start -> Run -> Perfmon.
Below is the full syntax and options available using Taskkill from the Command Prompt.
taskkill [/s Computer] [/u Domain\User [/p Password]]] [/fi FilterName] [/pid ProcessID]|[/im ImageName] [/f][/t]
/s computer
- Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u domain\user
- Runs the command with the account permissions of the user specified by User or Domain\User. The default is the permissions of the current logged on user on the computer issuing the command.
/p password
- Specifies the password of the user account that is specified in the /u parameter.
/fi FilterName
- Specifies the types of process(es) to include in or exclude from termination. The following are valid filter names, operators, and values.
Name | Operators | Value |
Hostname | eq, ne | Any valid string. |
Status | eq, ne | RUNNING|NOT RESPONDING |
Imagename | eq, ne | Any valid string. |
PID | eq, ne, gt, lt, ge, le | Any valid positive integer. |
Session | eq, ne, gt, lt, ge, le | Any valid session number. |
CPUTime | eq, ne, gt, lt, ge, le | Valid time in the format of hh:mm:ss. The mm and ss parameters should be between 0 and 59 and hh can be any valid unsigned numeric value. |
Memusage | eq, ne, gt, lt, ge, le | Any valid integer. |
Username | eq, ne | Any valid user name ([Domain\]User). |
Services | eq, ne | Any valid string. |
Windowtitle | eq, ne | Any valid string. |
/pid processID
- Specifies the process ID of the process to be terminated.
/im ImageName
- Specifies the image name of the process to be terminated. Use the wildcard (*) to specify all image names.
/f
- Specifies that process(es) be forcefully terminated. This parameter is ignored for remote processes; all remote processes are forcefully terminated.
/t
- Specifies to terminate all child processes along with the parent process, commonly known as a tree kill.
natxo asenjo
Could you not open the taskmanager from the shell: taskmgr.exe ?
you do not need perfmon to find the name of a process. Just use tasklist without arguments, you get all the running processes. See tasklist /? for all the valid switches.
It keeps amazing me that windows admins just do not know this kind of stuff
Chris
Task Manager hung and each process I opened after hung as well – so even opening it from the shell would not work. I did use tasklist, but Perfmon in 2008 gives far more information and will work even if Task Manager doesn’t. Task list will give you the PID, but perfmon will give you the additional information you need to use the filter arguments if you wish to terminate specific processes that exceed a certain threshold.