I don't want my VPS to log off disconnected sessions. It's really annoying because some programs freeze then. OS is Windows Server 2008 R2.

How do I prevent disconnected sessions from being logged off?

I have tryed pepoluan, rayan ries and Simon L answers

  • You've tried all of our suggestions and still your disconnected RDP sessions are being disconnected? Are you sure the server's not completely rebooting while you're away?
    – Ryan Ries
    Oct 22 '14 at 19:30

By default, a standalone Windows installation will not logoff disconnected RDP sessions.

So your installation must have been customized for it to be logging off disconnected RDP sessions.

Start MMC.

Load the Group Policy Object Editor snapin. It will be targeting the Local Computer.

Drill down to Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Session Time Limits

Verify that the setting "Set time limit for disconnected sessions" is either Not Configured, or Enabled, but with a setting of Never.

  • I've seen where "Not Configured" doesn't do anything, but "Enabled" with a limit of "Never" works.
    – teeks99
    Oct 25 '17 at 13:03
  • 1
    I tried it on Google VM of Windows and it doesn't seem to work. Any idea?
    – Royi
    Feb 18 '18 at 0:21

To add what @Ryan wrote, if the Local Security Policy is "Not Configured", next you must check the Terminal Services Configuration / Remote Desktop Configuration. Right-click the "Connection", choose "Properties", and check that there are no "Force Disconnect" option being enforced.

(I don't have access to a Windows Server 2008 R2 machine at the moment; I'll update/fix my answer when I regain access)

Erratum: The location is Start > Administrative Tools > Remote Desktop Services > Remote Desktop Session Host Configuration. Double-click on "RDP-Tcp", and go to the "Sessions" tab.

Edit to add: Do note, though, that without limiting sessions with forced logoffs, you will sooner or later run into the hard-coded 2 RDP sessions limitations (including 'console' sessions), necessitating a Forced Logoff after all.

  • There is "Override user settings" and all set to "Never"
    – user212180
    Mar 10 '14 at 8:19

The GPO answers work as well, i just wanted to add to the answers. This is as Ryan says, out of the ordinary, since by default your sessions can idle for as long as they want. You can however customize the disconnect time with the policy mentioned. The registry key involved with this policy, should you need to configure this on a single server is

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services

Create or update a DWORD called MaxDisconnectionTime Now set the amount of time a user can be disconnected in miliseconds. EG : 1209600000 for 14 days and so on.

If you want the disconnect to be unlimited you can delete the value.

  • None of GPO settings work on Windows 10 host. Let's try the registry hack. Nov 8 '19 at 10:09

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.