Microsoft KB Archive/321705

= HOW TO: Disconnect a Session by Using the TSDISCON Command in Windows 2000 Terminal Services =

Article ID: 321705

Article Last Modified on 10/31/2006

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional Edition

-



This article was previously published under Q321705



IN THIS TASK
SUMMARY
 * Description of the TSDISCON Command
 * How to Disconnect a Terminal Services Session

REFERENCES



SUMMARY
This article describes how to disconnect a Terminal Services session by using the tsdiscon command in Windows 2000 Terminal Services.

You can use the tsdiscon command to disconnect an active Terminal Services session. The session remains attached to the Terminal Services server in a disconnected state. Programs that are currently in use continue to run. When you reconnect to the Terminal Services server, you can reconnect by using the same session from which you disconnected. You can resume working without any loss of data in the programs that were running when you disconnected.

back to the top

Description of the TSDISCON Command
The tsdiscon command uses the following syntax:

tsdiscon  |   [/server: ] /v

The parameters that are used by the tsdiscon command are:
 *  : Use this parameter to specify the ID of the session that you want to disconnect. To determine the ID of the session that you want to disconnect, use the query session command.
 *  : Use this parameter to specify the name of the session that you want to disconnect. To determine the name of the session that you want to disconnect, use the query session command.
 * /server: : Use this parameter to specify the Terminal Services server that hosts the session that you want to disconnect. If you omit this parameter, the current Terminal Services server is specified.
 * /v: Use this parameter to display information about the actions that are being performed.

NOTE: You can disconnect your own sessions, but if you want to disconnect another user's session, you must have Full Control access permissions. You cannot disconnect the console session.

back to the top

How to Disconnect a Terminal Services Session
This is an example of how to use the tsdiscon command to disconnect a session on the current Terminal Services server:  In a Terminal Services session, click Start, and then click Run. Type cmd, and then click OK. Determine the name or ID of the session that you want to disconnect. To do so, type query session, and then press ENTER. You see a list of information about the sessions on the current Terminal Services server. The list may be similar to:

SESSIONNAME  USERNAME        ID      STATE    TYPE    DEVICE console     administrator       0   active   wdcon rdp-tcp                     65536   listen   rdpwd >rdp-tcp#1   user1               1   active   rdpwd rdp-tcp#2   user1               2   active   rdpwd rdp-tcp#3   user2               3   active   rdpwd rdp-tcp#4   user3               4   disc     rdpwd rdp-tcp#5   user1               5   disc     rdpwd 6  idle 7 idle

Note that in this example, the name of the current session is rdp-tcp#1, the session ID is 1, and it is owned by user1.

 To disconnect the current session, type the following line at the command prompt, and then press ENTER:

tsdiscon

 To disconnect session 2 by using the session ID, and to display information about the disconnect operation, type the following line at the command prompt, and then press ENTER:

tsdiscon 2 /v

You see the following line and session 2 is disconnected:

Disconnecting sessionID2 from sessionname rdp-tcp#2

 To disconnect session 5 by using the session name, type the following line at the command prompt, and then press ENTER:

tsdiscon rdp-tcp#5

</li></ol>

back to the top

<div class="references_section">