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



The information in this article applies to:

  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional

This article was previously published under Q321705

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 SessionID | SessionName [/server:ServerName] /v

The parameters that are used by the tsdiscon command are:
  • SessionID: 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.
  • SessionName: 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:ServerName: 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:
  1. In a Terminal Services session, click Start, and then click Run.
  2. Type cmd, and then click OK.
  3. 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.

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

    tsdiscon

  5. 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

  6. 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

back to the top

REFERENCES

For more information about the tsdiscon and query session commands, visit the following Microsoft Web site: For additional information about how to connect to another Terminal Services session by using the TSCON command, click the article number below to view the article in the Microsoft Knowledge Base:

321703 HOW TO: Connect to Another Session by Using the TSCON Command in Windows 2000 Terminal Services

For more information about Windows 2000 Terminal Services, visit the following Microsoft Web site: back to the top

Modification Type:MajorLast Reviewed:11/20/2003
Keywords:kbhowto kbHOWTOmaster KB321705 kbAudITPro