JSI Tip 5268. How do I end a Terminal Services server process from the command line?

The TSKILL command can be uses to end Terminal Services server processes.

You must have administrative privileges to end other user's processes.

When you type tskill /? at a CMD prompt, the following information is displayed:

Ends a process.

TSKILL processid | processname \[/SERVER:servername\] \[/ID:sessionid | /A\] \[/V\]

  processid           Process ID for the process to be terminated.
  processname         Process name to be terminated.
  /SERVER:servername  Server containing processID (default is current).
                         /ID or /A must be specified when using processname
                         and /SERVER
  /ID:sessionid       End process running under the specified session.
  /A                  End process running under ALL sessions.
  /V                  Display information about actions being performed.
NOTE: When all processes that are running in a session end, the session also ends.

NOTE: The user is NOT notified that you ended their process.

To determine the processes that are running, type:

query process

To find out who is running ProgramName.exe, type:

query process ProgramName.exe.

A display similar to the following is produced:

    administrator  console         0  1234    ProgramName.exe
    UserName1      rdp-tcp#1       1  1342    ProgramName.exe
    UserName2      rdp-tcp#2       2  1432    ProgramName.exe

TSKILL Examples:

tskill 1342 Ends ProgramName.exe for UserName1.
tskill ProgramName /a /v     Ends all instances of ProgramName.exe and displays information about the actions being performed.

TAGS: Windows 8
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.