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



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 Q321703

SUMMARY

This article describes how to connect to another existing Terminal Services session by using the tscon command in Windows 2000 Terminal Services.

You can use the tscon command to connect to another Terminal Services user session. You can connect to sessions that are in an active or disconnected state. When you connect to another session, you are disconnected from your previous session. If you create more than one session on a server, you can use this option to switch between the sessions.

back to the top

Description of the TSCON Command

The tscon command uses the following syntax:

tscon SessionID | SessionName [ /server:ServerName] [/dest:SessionName] [/password:Password] /v

The parameters for the tscon command are:
  • SessionID: Use this parameter to specify the ID of the session to which you want to connect. To determine the ID of the session to which you want to connect, use the query session command.
  • SessionName: Use this parameter to specify the name of the session to which you want to connect. To determine the name of the session to which you want to connect, use the query process command.
  • /server:ServerName: Use this parameter to specify the Terminal Services server that hosts the session to which you want to connect. If you omit this parameter, the current Terminal Services server is specified.
  • /dest:SessionName: Use this parameter to specify the name of the session. When you connect to another session, this session is disconnected. You can use this parameter to connect the session of another user to a different session.
  • /password:Password: Use this parameter to specify the password of the user who owns the session to which you want to connect. You must use this parameter to specify the password if you are not the owner of the session.
  • /v: Use this parameter to display information about the actions that are being performed.
NOTE: You can connect to your own sessions, but if you want to connect to another user's session, you must use that user's password and you must have either Full Control or User Access permission. You cannot use the tscon command to connect to the console session.

back to the top

How to Connect to Another Terminal Services Session

This is an example of how to use the tscon command to connect to another 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 to which you want to connect. 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 this:

    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 the session is owned by user1.

  4. To connect to session 2, type the following line at the command prompt, and then press ENTER:

    tscon 2 /v

    You see the following line:

    Connecting sessionID2 to sessionname rdp-tcp#1

    The current session (session 1) is disconnected, and you are connected to Session 2.

  5. To connect to session 1 (from session 2), type the following line at the command prompt, and then press ENTER:

    tscon 1

    The current session (session 2) is disconnected, and you are connected to session 1.

  6. To connect session 5 to session 2 from another session, type the following line at the command prompt, and then press ENTER:

    tscon 2 /v /dest:rdp-tcp#5

    You see the following line:

    Connecting sessionID2 to sessionname rdp-tcp#5

    Session 2 is connected to session 5, and session 5 is disconnected.

  7. To connect to session 4 (which is owned by User3), type the following line at the command prompt, where User3Pass is the password for User3, and then press ENTER:

    tscon 4 /password:User3pass

    The current session disconnects, and you are connected to session 4.
back to the top

REFERENCES

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

321705 HOW TO: Disconnect a Session by Using the TSDISCON 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 KB321703 kbAudITPro