Microsoft KB Archive/320052

= HOW TO: Use the TSKILL Command to End Processes in Windows 2000 Terminal Services =

Article ID: 320052

Article Last Modified on 11/1/2006

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server

-



This article was previously published under Q320052



IN THIS TASK
SUMMARY
 * Description of the TSKILL Command
 * How to End Processes

REFERENCES



SUMMARY
This step-by-step article describes how to end active processes that are running on a Terminal Services server by using the tskill command.

You can end active processes that are running on a Terminal Services server by right-clicking the processes on the Processes tab in Terminal Services Manager, and then clicking End Process, or by using the tskill command. Note that if you end a process, no notification is sent to the user. The process is immediately ended.

Only administrators can use the tskill command to end processes that run in other user sessions. Unless you are logged on as Administrator or as a member of the Administrators group, you can use tskill to end only those processes that belong to you.

back to the top

Description of the TSKILL Command
The tskill command has the following syntax:

tskill  |   [/server: ] [/id:  | /a] [/v]

The parameters for the tskill command are:
 *  : Use this parameter to specify the ID of the process that you want to end. To determine the ID of the process that you want to end, use the query process command.
 *  : Use this parameter to specify the name of the process that you want to end. To determine the name of the process that you want to end, use the query process command.
 * /server: : Use this parameter to specify the Terminal Services server that contains the process that you want to end. If you omit this parameter, the current Terminal Services server is specified.

NOTE: If you use this parameter, you must also use either the /id:  or the /a parameter.
 * /id: : Use this parameter to specify the ID of the session that contains the process that you want to end.
 * /a: Use this parameter to end all instances of the process that is running on the server.
 * /v: Use this parameter to display information about the actions that are performed when you run the command.

NOTE: When all processes that are running in a session end, the session also ends.

back to the top

How to End Processes
To use the tskill command to end processes on a Terminal Services server:  Click Start, and then click Run. Type cmd, and then click OK.  Determine the name or ID of the process that you want to end. To do so, use the query process command.

For example, to display a list of all users who are running the Myapp.exe process on the current Terminal Services server, type query process myapp.exe at the command prompt, and then press ENTER. You receive a list of all users who are running the Myapp.exe process. The list may be similar to this:   USERNAME        SESSIONNAME     ID PID     IMAGE >administrator console         0  1248    myapp.exe user1         rdp-tcp#1       1  1592    myapp.exe user2         rdp-tcp#2       2  1588    myapp.exe  To end the Myapp.exe process for User1 by using the process ID, type the following line at the command prompt, and then press ENTER:

tskill 1592

To end all instances of the Myapp.exe process that are running on the current Terminal Services server and to display information about the actions that are performed when you run the command, type the following line at the command prompt, and then press ENTER:

tskill myapp /a /v

To end the Myapp.exe process from a remote Terminal Services server for User2 by using the process name, type the following line at the command prompt, where Server8 is the name of the Terminal Services server that contains the Myapp.exe process that you want to end, and then press ENTER:

tskill myapp /server:server8 /id:2



back to the top

