Thursday, October 16, 2008

Remote Desktop - How to connect to another session?

One of the problems we face in RDP is that it opens multiple sessions for the same user id. So, when we are working in collaborative mode where one user starts a work, then another monitors it and third finishes it, connecting through RDP is a major issue as when for each user it opens a new session, even if user ids are same.

We can use some command line functions available in Windows 2003/XP (that is the ones I checked with) to connect to the desired session.

How to Connect to Another Session

  1. Log in using RDP and same userid Pwd as that of session to which you want to connect using mstsc command.
    mstsc /console
  2. Once you are connected, type cmd in run and press enter.command window opens up. Now we have to find out the session id of the session to which we want to connect.

  1. Type query session in the command window. We will be able to see all the connected sessions.
SESSIONNAME
USERNAME
ID
STATE
TYPE
DEVICE
console
administrator
0
active
wdcon
 
rdp-tcp
 
65536
listen
rqpwd
 
/>rdp-tcp#1    
User1
1
active
rqpwd
 
rdp-tcp#2    
User2
2
active
rqpwd
 
rdp-tcp#3    
User1
3
active
rqpwd
 
rdp-tcp#4    
User3
4
Disc
rqpwd
 
rdp-tcp#5    
User1
5
disc
rqpwd
 
 
 
6
Idle
 
 
 
 
7
idle
 
 
 
 
 
 
 
 
4.    Note that in above example name of connected session is rdp-tcp#1 denoted by a > in front of it

  1. To connect to session 3, type

tscon 3 /v and press enter and you will find that screen flickers and you are on the session 3

  1. To connect to session 1 from session 3 type

tscon 1

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

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

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

For further readings refer to microsoft documentaiton.