HOW TO: Use the TSKILL Command to End Processes in Windows 2000 Terminal Services (320052)



The information in this article applies to:

  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server

This article was previously published under Q320052

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 ProcessID | ProcessName [/server:ServerName] [/id:SessionID | /a] [/v]

The parameters for the tskill command are:
  • ProcessID: 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.
  • ProcessName: 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:ServerName: 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:SessionID or the /a parameter.
  • /id:SessionID: 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:
  1. Click Start, and then click Run.
  2. Type cmd, and then click OK.
  3. 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
    					
  4. 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

REFERENCES

For more information about the query process and tskill commands, visit the following Microsoft Web site: For more information about Windows 2000 Terminal Services, visit the following Microsoft Web site: back to the top

Modification Type:MajorLast Reviewed:10/30/2003
Keywords:kbhowto kbHOWTOmaster KB320052 kbAudITPro