Windows VPS & RDP

Stop Remote Desktop sessions ending when idle or disconnected

Find the Group Policy session time limits that sign you out of an idle or disconnected RDP session, change them safely and keep long-running apps alive.

IntermediateWindows server5 min read

If your Remote Desktop session closes after a quiet spell, or your apps are gone when you reconnect, a session time limit is usually the cause. Windows can end idle, disconnected or even active sessions after a set time. This guide shows where those limits live, how to change them, and how to keep long-running programs safe.

Before you start

  • A Windows VPS (Windows Server 2019, 2022 or 2025) or Admin RDP desktop on Windows 10/11 Pro.
  • An account with administrator rights. Connect as usual on 203.0.113.10:3389.
  • The Local Group Policy Editor (gpedit.msc). It is included on Windows Server and on Pro editions of Windows 10/11.

Note: If your server is joined to an Active Directory domain, a domain policy can override local settings. In that case change the limits in the domain Group Policy Object instead.

Know which limit you are hitting

Windows has three separate timers for Remote Desktop sessions:

  • Idle limit: the session is connected but nobody touches the mouse or keyboard. When the time runs out, Windows disconnects or ends the session.
  • Disconnected limit: you closed the RDP window or your network dropped, so the session keeps running with nobody attached. When this timer ends, Windows signs the session out and closes every program in it.
  • Active limit: a hard cap on how long any session can stay connected, even while you work.

A fourth setting, End session when time limits are reached, decides what happens when the idle or active limit runs out. When it is enabled, Windows signs you out instead of only disconnecting.

The disconnected limit is the one that hurts most. It closes trading terminals, bots and downloads you left running on purpose.

Check the current settings

Open PowerShell or Command Prompt on the server and generate a policy report:

CMD
gpresult /h C:\gp-report.html

Open C:\gp-report.html in a browser and search for Session Time Limits. Any setting listed there is applied, and the report shows whether it comes from Local Group Policy or a domain policy.

You can also read the policy values straight from the registry:

PowerShell
Get-ItemProperty 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' |
  Select-Object MaxIdleTime, MaxDisconnectionTime, MaxConnectionTime, fResetBroken

The times are in milliseconds. For example, 3600000 is one hour. Empty values mean no computer-level limit is set by policy.

Tip: Limits can also be set per user. Check the same key under HKCU:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services while signed in as the affected user.

Change the limits in Group Policy

  1. Press Win + R, type gpedit.msc and press Enter.
  2. Go to Computer Configuration → Administrative Templates → Windows Components → Remote Desktop Services → Remote Desktop Session Host → Session Time Limits.
  3. Open each policy you want to change:
  • Set time limit for active but idle Remote Desktop Services sessions
  • Set time limit for disconnected sessions
  • Set time limit for active Remote Desktop Services sessions
  • End session when time limits are reached
  1. Pick one of three states:
  • Not Configured: the policy does not apply and the default behaviour (no limit) is used.
  • Enabled with Never: explicitly no limit.
  • Enabled with a time: the session ends or disconnects after that time.
  1. Click OK, then apply the change:
CMD
   gpupdate /force

The same policies exist under User Configuration at the matching path. If a limit appears there, change it too, or it will still apply to that user.

New limits affect sessions started after the change. Sign out once and connect again to be sure.

Pick sensible values

There is no single right answer. These are reasonable starting points:

  • Single-user server running 24/7 apps: idle limit Never, disconnected limit Never. Lock the session instead of relying on timeouts.
  • Shared team server: idle limit a few hours, disconnected limit a day or more. That frees memory from forgotten sessions without surprising people mid-task.
  • Security-sensitive server: a short idle limit that only disconnects, with End session when time limits are reached left disabled. Your apps keep running and the screen is protected.

Warning: Setting the disconnected limit to a short time on a server that runs unattended programs will close those programs without warning. Save your work before testing new values.

Keep long-running apps alive

  • Disconnect, do not sign out. Close the RDP window with the X on the connection bar. Choosing Sign out from the Start menu ends every app.
  • Run background jobs as services or scheduled tasks so they do not depend on a desktop session at all.
  • Turn off the screen lock and sleep timers that can interrupt some apps. These are separate from session limits.
  • Plan for reboots. Windows Update restarts still end every session, whatever the time limits say.

Check it works

  1. Connect on 203.0.113.10:3389 and start a harmless program, such as Notepad with some unsaved text.
  2. Close the RDP window to disconnect.
  3. Wait longer than your old limit, then reconnect.
  4. Notepad should still be open with your text.

From an elevated prompt you can also list sessions and their state:

CMD
quser

A disconnected session shows the state Disc and the idle time. It should stay in the list instead of vanishing.

Troubleshooting

  • The setting is greyed out or reverts: a domain policy is overriding it. Check the Winning GPO column in the gpresult report.
  • Session still ends at the same time: the limit is also set under User Configuration. Check the HKCU policy key shown above.
  • Session ends when you connect from another PC: that is the single-session behaviour, not a timeout. Your old session is being taken over or reset.
  • Apps close overnight anyway: look in Event Viewer for a restart at that time. Windows Update or a scheduled task may be rebooting the server.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.