JSI Tip 5428. How do I use the TSDISCON command to disconnect a Windows 2000 Terminal Services session, and subsequently reconnect, without loss of data in the running programs?

Jerold Schulman

June 12, 2002

1 Min Read
ITPro Today logo in a gray background | ITPro Today

When you use the TSDICON command to disconnect an active Terminal Services session, the session remains attached to the Terminal Services server, but in a disconnected state. Programs that were running remain running. You can subsequently reconnect to the same session and resume work without loss of data in the running programs.

When you type tsdiscon /?, you receive:

Disconnects a terminal session.TSDISCON [sessionid | sessionname] [/SERVER:servername] [/V]  sessionid           The ID of the session.  sessionname         The name of the session.  /SERVER:servername  Specifies the Terminal server (default is current).  /V                  Displays information about the actions performed.

NOTE: You cannot disconnect the console session.

NOTE: To disconnect another user's session, Full Control permission is required.

Example:

To disconnect a session on the current Terminal Services server:

1. Open a CMD prompt.

2. Type query session. You will receive a display like:

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   active   rdpwd                                  6   idle                                  7  idle

where rdp-tcp#1 is the current session, session ID 1, owned by user1.

3. To disconnect the current session, type tsdiscon. To disconnect session ID 2, type tsdiscon 2 /v, which will display Disconnecting sessionID 2 from sessionname rdp-tcp#2. To disconnection rdp-tcp#5, type tsdiscon rdp-tcp#5.

NOTE: See How do I connect to another existing Terminal Services session by using the TSCON command in Windows 2000 Terminal Services?



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like