The TSCON command will connect to another active or disconnected session. When you connect to another session, you are disconnected from your previous session.
When you open a CMD prompt and type TSCON /?, you receive:
Attaches a user session to a terminal session. TSCON \[sessionid | sessionname\] \[/SERVER:servername\] \[/DEST:sessionname\] \[/PASSWORD:pw\] \[/V\] sessionid The ID of the session. sessionname The name of the session. /SERVER:servername The name of the Terminal server to connect to (default is current). /DEST:sessionname Connect the session to destination sessionname. /PASSWORD:pw Password of user owning identified session. /V Displays information about the actions performed.NOTE: To connect another user's session, Full Control permission is required.
Example:Open a CMD prompt and 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 disc rdpwd 6 idle 7 idlewhere rdp-tcp#1 is the current session, session ID 1, owned by user1.
To connect to session 2, type tscon 2 /v, which will return Connecting sessionID2 to sessionname rdp-tcp#1.
To connect to session 1, from session 2, type tscon 1.
To connect to session 5 to session 2, from session 1, type tscon 2 /v /dest:rdp-tcp#5, which will return Connecting sessionID2 to sessionname rdp-tcp#5. Session 2 is connected to session 5, and session 5 is disconnected.
To connect to session 4, owned by user3, type tscon 4 /password:User3Password. Your current session will disconnect and you will be connect to session 4.