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.
- Intermediate
- Windows VPS · Admin RDP
- 5 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 RunRacks 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:12230. - The Local Group Policy Editor (
gpedit.msc). It is included on Windows Server and on Pro editions of Windows 10/11.
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:
gpresult /h C:\gp-report.htmlOpen 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:
Get-ItemProperty 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' |
Select-Object MaxIdleTime, MaxDisconnectionTime, MaxConnectionTime, fResetBrokenThe times are in milliseconds. For example, 3600000 is one hour. Empty values mean no computer-level limit is set by policy.
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
- Press Win + R, type
gpedit.mscand press Enter. - Go to Computer Configuration → Administrative Templates → Windows Components → Remote Desktop Services → Remote Desktop Session Host → Session Time Limits.
- 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
- 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.
- Click OK, then apply the change:
gpupdate /forceThe 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.
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
- Connect on
203.0.113.10:12230and start a harmless program, such as Notepad with some unsaved text. - Close the RDP window to disconnect.
- Wait longer than your old limit, then reconnect.
- Notepad should still be open with your text.
From an elevated prompt you can also list sessions and their state:
quserA 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
gpresultreport. - 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
- Keep programs running after you disconnect: Keep apps running 24/7 on an RDP server.
- Stop the screen locking during long sessions: Disable the lock screen timeout over RDP.
- Clean up a session that refuses to close: Sign out a stuck or disconnected RDP session.
- Need a server that runs around the clock? Compare Windows VPS plans.
Was this guide helpful?
Still stuck?
Ask RunRacks AI for a quick answer, or open a ticket and our team will take a look at your server.
Related guides
Windows VPS & RDP
RunRacks RDP port 12230: how to connect to your Windows VPS and Admin RDP
RunRacks Windows VPS and Admin RDP servers accept Remote Desktop on port 12230, not 3389. Here is how to connect from every device and keep the port open.
- Beginner
- Windows VPS · Admin RDP
- 5 min read
Windows VPS & RDP
Allow or block multiple RDP sessions for one user
Understand why a new Remote Desktop login takes over your old session, how the single-session policy works on Windows Server, and which setting suits a team.
- Advanced
- Windows VPS
- 5 min read
Windows VPS & RDP
Create Windows users with Remote Desktop access
Give each person their own Windows login, add them to Remote Desktop Users, test the account and remove access cleanly later.
- Beginner
- Windows VPS · Admin RDP
- 2 min read