5

I remote from my home PC (Windows 10) to my work computer (Windows 7) and every time I disconnect my remote connection (or just close it), after some time (around 1 hr) the work Windows session logs out and next time I remote or when I get to work the next day, I find my session logged out. All my open software closes, of course.

We tried the following solution:

https://serverfault.com/questions/269438/how-to-stop-remote-desktop-from-closing-my-session-due-to-inactivity

But nothing has been solved. It seems to be a timeout issue after remote disconnection, but I cannot find the config for this.

Any known solution for this?

  • 1
    It should just automatically lock the session, not log you out. Could it be a power saving setting? If it's a work computer you're connecting to, there could be group policy related to security in play. Do you have a Windows server at work? – boot13 Nov 30 '15 at 2:16
  • Yes, windows server but the IT people have checked all settings and there is nothing at the server level. It is only my session which gets logged out. Not locked... completely logged out and all programs are closed!! – samyb8 Nov 30 '15 at 2:33
  • Group policy sometimes goes bonkers. Or they overlooked a GPO setting. But I bet that's what it is. Do you have another account you can log in with (to the domain) as a test? If so, log in remotely from the same machine, with that other user. Does it make any difference? If it does, then you're looking at a user policy rather than a machine policy. See social.technet.microsoft.com/Forums/windowsserver/en-US/… – boot13 Nov 30 '15 at 3:31
  • On the Windows 7 server, start gpedit.msc, browse to Computer Configuration --> Administrative Templates --> Windows Components --> Remote Desktop Services --> Remote Desktop Session Host --> Session Time Limits. Enable "Set time limit for disconnected sessions" and set it to Never. Reboot and test. Verify after reboot the registry setting described here. If this doesn't work and your server is in a domain, have the IT people check in your OU the setting of "Terminate disconnected session". – harrymc Nov 30 '15 at 7:19
  • Can the problem be related to a windows update failing to install and it tries to install itself every night, an easy to check problem – Ferrybig Dec 2 '15 at 11:27
3
+50

On the Windows 7 server :

  1. Start gpedit.msc
  2. Browse to :
    Computer Configuration --> Administrative Templates --> Windows Components --> Remote Desktop Services --> Remote Desktop Session Host --> Session Time Limits.
  3. Enable "Set time limit for disconnected sessions" and set it to Never.
  4. Use regedit to go to the key
    HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
    and ensure that MaxDisconnectionTime is set for the amount of time you want to set as the time limit in milliseconds (12 hours = 43200000). If it does not exist, create it as New DWORD (32-bit). (more info.)
  5. Reboot.
  6. Verify after reboot that the above registry setting has not changed. (In a domain, the domain settings may override local ones.)

If this doesn't work and your server is in a domain, have the IT people check in your OU the setting of "Terminate disconnected session".

  • The problem may be caused by GPO - this solution may fix it, but it depends on the Group Policy. It may overrule this setting every time its applied. But this is definitely the solution :) – leinad13 Dec 2 '15 at 11:41
  • Why to edit registry and not just set the value Set Time Limit for Idle Remote Desktop Services Sessions? This RDP settings are usually set in GPO, so they will have little impact in corporate network anyhow. In fact it will be necessary to wite a script that would modify registry keys every minute to keep up with GPO refresh interval. – Vojtěch Dohnal Dec 7 '15 at 9:35
  • @VojtěchDohnal: Because MaxIdleTime can be overridden, I counseled verifying it after the boot. Remark that this post is for a disconnected session, not for idle one. – harrymc Dec 7 '15 at 12:34
  • So why not just add MaxDisconnectionTime registry key if MaxIdleTime is not needed? This answer seems to me too similar to what OP has specified as already tried solution. – Vojtěch Dohnal Dec 9 '15 at 16:36
  • Oups, I did mean MaxDisconnectionTime. Corrected. Apparently the poster didn't need to go that far. Thanks. – harrymc Dec 9 '15 at 18:24
0

The delay ("after some time (around 1h)") tells me that maybe your Power Options are set to an odd configuration. Check Control Panel > Power Options and see if there's anything there regarding shutdown after inactivity. Otherwise, see if your Group Policy settings are forcing logouts.

0

Here is how I do it:

Create a Disconnect.bat file on your desktop at work. Edit it with notepad like this:

rundll32.exe user32.dll,LockWorkStation 
tscon rdp-tcp#0 /dest:console

Then when you want to disconnect your RDP session from home, do not close the remote desktop window and do not disconnect, instead click on the disconnect.bat file on your desktop at work (seen remotely from home).

On your home computer there will be a message box displayed with a message that you have been disconnected, do not worry about that. You will get disconnected at home but your desktop at work will remain as if you walked away from it. It means that you remain logged in etc.

The advantage of this approach is that it works regardless on domain group policy settings - IT staff of bigger companies is seldom willing to modify or create a new policy just for one user.

Actually other answers exist even on this site with the same hint, check them to find a suitable version for you: https://superuser.com/a/355936/285900

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.