7

I'm working on a project where I must do almost all of my work on a remote desktop. I also have to frequently connect and disconnect from the remote desktop because of the network configuration.

Sometimes, when I disconnect my session and then connect again, I get connected to the same session. Other times, it starts a new session for me, but I can tell that the old session is still running because it shows a warning if I click to restart the computer.

There seems to be no rhyme or reason to this. Given the choice, I would like to make MSTSC always connect me to my existing session.

How do I do this?

Vivian River
  • 329
  • 4
  • 10

2 Answers2

5

I found another great answer to this question here: http://sqlservertimes2.com/?p=55.

If you connect to a remote desktop and it creates a new session instead of connecting to your existing session, do the following:

Run taskmgr and go to the Users tab and note the ID number of your previous session.

Run tscon n where n is the ID number. Your remote desktop session will be immediately switched to the specified session.

Vivian River
  • 329
  • 4
  • 10
  • 1
    The accepted answer may be the best way to prevent this situation ever happening, but odds are that a user running into the problem does not have immediate control of Group Policies—and my network admins may have very good reasons for permitting multiple connections per user. So, this solution will be applicable to far more people. Also, it's very handy for people like me using RDP from Linux systems who don't want to know any more about Windows than we can help :-) – Auspex Nov 12 '19 at 14:51
3

Use Local Security Policy (or Group Policy if the machine is in a domain) to limit users to a single RDP session.

Open Local/Group Policy.

  1. In Computer Configuration, Administrative Templates, Windows Components, Terminal Services, double-click the Restrict Terminal Services users to a single remote session setting.

  2. Click Enabled, and then click OK.

Note: Replace "Terminal Services" with "Remote Desktop Services" if on a modern version of Windows.

Ryan Ries
  • 55,011
  • 9
  • 138
  • 197
  • I'm marking this as the answer. However, the second answer may be more appropriate depending on exactly what your needs are. – Vivian River Mar 12 '14 at 18:08
  • 1
    Yep, that's true. Both answers given will solve your problem. Feel free to mark whichever one better fits your needs as the answer. I promise you won't hurt my feelings. ;) – Ryan Ries Mar 12 '14 at 18:47
  • This answer has the advantage that it only has to be done once. The other answer has the advantage that it can be done without changing system settings requiring admin permissions, and it allows for multiple sessions where that might be necessary. – Vivian River Mar 12 '14 at 19:52
  • Can you mention how to access the Terminal / Remote Desktop Services settings in Windows Server 2016?. I tried but couldn't find. Thanks. – Saqib Vaid Oct 13 '19 at 10:02