12

While I am using remote desktop connection(mstsc.exe), when I close the connection, I get logged off from the remote machine.

Is there a way to stop logging off after disconnection ?

Client and server computers are running Windows 8 only.

Please note that:

tscon.exe RDP-Tcp#1 /dest:console

is giving this error :

Sessionname RDP-Tcp#1 not found

I have tried the following as well without success:

tscon.exe 0 /dest:console 
tscon.exe 1 /dest:console
harrymc
  • 455,459
  • 31
  • 526
  • 924
PKSA
  • 131
  • 1
  • 1
  • 6
  • Strange, it never happend to me using default settings on win 8 or win 7. As long as you do not press win button and press log out it should just close the session but not log out. – Ivan Viktorovic Dec 03 '15 at 22:08
  • I have connected to remote machine and then I exit the remote connection. I want that the remote machine shall not logg off – PKSA Dec 04 '15 at 06:18
  • The thing is that it logs out the remote user as you log in, so simply closing the connection doesn't reinstate the previous user. I'd love to find a workaround for this too. – Tetsujin Dec 04 '15 at 11:20
  • Yeh thats right as long as you use two differnet users, if it is same same it just takes that session. You need a terminal server or a server version if you want multiple sessions with the same user i think – Ivan Viktorovic Dec 04 '15 at 12:57
  • I am logging to the currently active user. It still presents them with the lock-screen as soon as I log in. Tested on 2 comps physically next to each other, so visual examination from both sides is simple. This has been since possibly XP, definitely 7 & continues on 10. I'd love to be able to do it interactively, like I can with Apple's Remote Desktop or even TeamViewer. – Tetsujin Dec 06 '15 at 12:46
  • Curious to know what error these 2 commands give you (tscon.exe 0 /dest:console tscon.exe 1 /dest:console), as this is what I use daily. – IronWilliamCash Oct 03 '16 at 19:46

3 Answers3

7

A few things after reading your question, some of the comments, and your comments back and forth to and from others. I'm posting some detail and then a potential solution at the bottom which I've confirmed worked fine in a test/lab environment a while back. I encourage you to read over my answer entirely as there are some gotchas, etc.

  1. How to stop remote desktop logoff after closing the connection

For this question above, others have answered and suggested the GPO settings—"idle and disconnected session time limits to unlimited"—to look over and ensure that the user disconnects rather than logoff.

  1. I am logging to the currently active user. It still presents them with the lock-screen as soon as I log in. Tested on 2 comps physically next to each other, so visual examination from both sides is simple. This has been since possibly XP, definitely 7 & continues on 10. I'd love to be able to do it interactively, like I can with Apple's Remote Desktop or even TeamViewer.


Notable Items

  1. Using TeamViewer on Windows will still not allow multiple or concurrent RDP sessions on a Windows non-Server OS. It will allow you to interact with currently existing RDP sessions or active console sessions only. If you do not have more than one of those to connect to for interacting with, it'll not give you the expected result.

  2. Microsoft sells Server OSes and Client Access Licenses for Terminal Server access with a cost associated per user or per device CAL as I've seen others mention in comments, answers, etc. So for Microsoft non-Server OSes, they leave this Terminal Server RDP-expanded functionality not enabled or disabled for that reason.

  3. Microsoft Server OSes can usually handle more concurrent RDP sessions more efficient on the same machine with more memory support. They also don't have as much Microsoft built-in features and functions enabled by default. Non-Server Windows OSes may have to be configured explicitly disabling unnecessary things from running by default optimizing performance.


The Potential Workaround

Warning: I suggest doing this in only a test or lab environment for testing purposes only, so I'm not suggesting to use this for production purposes in a business environment. Otherwise, use with caution and at your own risk since I have no idea about the legalities of using this long-term for such purposes.

Referenced below is a link to a source called RDPWrap which is on GitHub that is a free download. Posted there are full instructions with screen shots for visuals on the site including step-by-step detail—it is only trivial to figure out and get it tested.

To download you need the actual install file rather than the non-compiled source code, from the below link named RDPWrap Install File Download Link in the Download section of that page. Just click on the link named RDPWrap-v1.6.zip to download the EXE and batch install files contained within this ZIP file (screen shot below).

Gotchas

If you apply Windows Updates on one of your test machines and this functionality ends up not working afterwards, you may need to run the install again to patch over the files, etc. You may also need to check the source GitHub resources for other bug patches within new releases since this is something someone else provides and Windows OSes should apply Windows Updates for security reasons.


Important: Domain level Group Policy and/or Security Policy settings may override all the below listed local Registry, local Group Policy, and local Security Policy settings. From what I can tell but not confirm myself, ensuring these settings are set as specified will prevent disconnected RDP sessions from being logged off after a certain period of time. You may need to reboot the machine after making any local settings changed below for those to become effective. You may need to check for domain level Group Policy or Security Policy settings that take precedence over the local settings if you still have trouble after ensuring these settings are set locally per machine.



Concurrent RDP Session Same User Account Registry Values

Change these registry values as shown in the screen shot to enable or disable the ability to allow more than one concurrent RDP session with the SAME account. You'll need to change and/or create this key manually perhaps and set per each run of the RDPWrap patch software on your test systems.

To change this setting, you'll need to perform a registry change. The following steps describe the process:

  1. Start Registry Editor (by default, this is located at c:\windows\regedit.exe).

  2. Go to the following registry key:

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer

  3. If the fSingleSessionPerUser value doesn't exist, create a new DWORD value named fSingleSessionPerUser

  4. Open the fSingleSessionPerUser value. The possible values for this setting are as follows:

0x0

  Allow multiple sessions per user

0x1

Force each user to a single session
  1. Enter the new setting, and then click OK.

Ensure Disconnected RDP Sessions aren't Logged Off Automatically

A. From GPEDIT.MSC ALL the below settings in both Computer Configuration and User Configuration need to be set to a State of Not configured.

These Group Policy settings are located in the following locations:

  • Computer Configuration\Policies\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Session Time Limits
  • User Configuration\Policies\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Session Time Limits

enter image description here


From Community Spiceworks Comment

B. From SECPOL.MSC the below (screen shot highlighted) setting in Interactive logon: Do not require CTRL+ALT+DEL needs to be set to a Enabled.

1. Local Policies\Security Options

enter image description here


Download Link Screen Shot

enter image description here


Sources:

Vomit IT - Chunky Mess Style
  • 40,038
  • 27
  • 84
  • 117
  • 1
    Wow! Major detail. Let me absorb this tomorrow [bit late here right now] & I will let you know. Thank you for putting so much time into this one. – Tetsujin Dec 12 '15 at 17:32
  • Its great that multiple people can access without getting disconnected. – PKSA Dec 18 '15 at 12:33
  • But I need is that when I click close the system shall not logout. But it is logging off. – PKSA Dec 18 '15 at 12:34
  • @LMFAO_A_JOKE i have tried this but it did not actually solved my problem. It is allowing a machine to establish 2 connections but they cant see the same page, the way we can do it in TeamViewer or VNC etc. Further my problem was that I was the only one logged into the machine and I disconnect my RDC machine the machine should not log off – PKSA Jan 09 '16 at 04:37
  • @PKSA Okay, this is the way Microsoft designed the RDP feature to work that they allow you to utilize unfortunately so using the native Windows RDP functionality you cannot screen share as far as I know. This solution allows multiple concurrent RDP sessions by the same or separate user accounts without bumping others off so this essentially makes the desktop Windows OS behave like a Terminal Server with applicable policies set. So is PKSA and Tetsujin the same person or what? I'm not sure why I did not see or respond to this back in Jan. 2016 but there you have it. – Vomit IT - Chunky Mess Style Jul 11 '17 at 13:25
  • I have issue on Google Cloud VM. I want the desktop to keep running even without RDP connected to the VM (So I will be able to launch desktop applications). Will any of those help? – Royi Feb 17 '18 at 23:41
  • I want to launch a program with UI without being on RDP. – Royi Feb 18 '18 at 03:32
  • @Royi And I suspect this UI doesn't have any equivalent CLI you could script, correct? In the past I have had success with such operations using AutoIT where there was absolutely no other way with CLI or some sort of application scripting. What program is it by chance, an industry standard program or perhaps some custom written app or something? Have you ever used the FREE [AutoIT](https://www.autoitscript.com/site/autoit/) software? – Vomit IT - Chunky Mess Style Feb 18 '18 at 03:37
3

this can be caused by group policy or local security policy on your local machine. The steps to fix this in both instances are similar:

  • Launch the local group policy editor: https://technet.microsoft.com/en-us/library/cc754685.aspx (start > search box > gpedit.msc) (for domain users, launch group policy management, browse to your servers OU and edit the GPO)

  • Browse to the following GP Setting: Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Session Time Limits - when there, make sure you have set the idle and disconnected session time limits to unlimited.

Restart your machines.

Try performing this on both PCs (most likely the one you are RDPing to) and see how you get on.

Fazer87
  • 12,520
  • 1
  • 36
  • 48
1

To disconnect without ending your Remote Desktop session You can temporarily disconnect from a session by clicking the Close button on the connection bar (the horizontal bar at the top of your screen). This leaves your programs running so that, next time you connect, you can continue where you left off.

Even this may help https://technet.microsoft.com/en-in/library/cc754272.aspx

Rohan Gala
  • 215
  • 2
  • 8
  • I'm beginning to think I Bountied the wrong question really. My main gripe is that the user at the other end is logged off. I can reconnect in a second from my collection of 'bookmarks' but the other user is left just gazing at a login screen all the time I'm there & also doesn't really know when I've finished. I'm almost tempted to just swap to TeamViewer if RDC can't do it :( – Tetsujin Dec 12 '15 at 11:16