RDP Session Timeout: Fix Idle Disconnects and Logoffs

Learn how to fix an RDP session timeout, set safe idle and disconnected limits, and tell a Group Policy logoff from a network drop for long jobs.
A glowing remote desktop window, server, and timer ring connected by blue light trails.

An RDP session timeout can disconnect an idle desktop, end a session after a fixed duration, or log off a disconnected user. The fix is to identify which Windows Session Time Limits policy is firing, then choose a value that fits your workload.

What you need before changing an RDP session timeout

You need an administrator account, permission to edit local or domain Group Policy, and the approximate time and message shown when the session drops. Note whether you were using the desktop, had closed the RDP client, or left a bot or EA running without input.

If the server belongs to a domain, its policy can overwrite a local change. Record the current settings, and export the relevant registry key before editing it.

Idle, active, and disconnected limits explained

Windows treats these as different session states. That distinction matters because a trading EA or automation process can be working while the desktop itself has received no human input.

SettingWhat it measuresWhat normally happens when it expires
Set time limit for active but idle Remote Desktop Services sessionsTime since the session received keyboard or mouse inputThe active session is disconnected; Windows normally warns two minutes before the disconnect
Set time limit for active Remote Desktop Services sessionsTotal time since the session was connectedThe active session is disconnected after the selected duration, even if you are working
Set time limit for disconnected sessionsTime since you closed the RDP client or lost the connectionThe disconnected session is removed after the limit, which ends its running programs
End session when time limits are reachedWhat Windows does after an active or idle limitA timed-out session is logged off instead of merely disconnected

When these policies are not configured, Microsoft documents the three limits as unlimited at the Group Policy level. A disconnected session can remain with its programs running until another setting removes it. See the Microsoft policy reference for defaults and precedence.

An RDP client dropping because of Wi-Fi or another network event is different: the server may keep the session active. A policy timeout usually repeats at a predictable interval and produces a timeout message.

Step 1: Open the Session Time Limits policies

The goal is to see every policy that can disconnect or end your session before changing one setting.

  1. Press Win + R, type gpedit.msc, and press Enter. On a domain-managed server, open the relevant Group Policy Object in gpmc.msc instead.
  2. Go to Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Session Time Limits.
  3. Inspect Set time limit for active but idle Remote Desktop Services sessions, Set time limit for active Remote Desktop Services sessions, Set time limit for disconnected sessions, and End session when time limits are reached.
  4. Check both Computer Configuration and User Configuration if the local editor or domain policy exposes both. Computer policy takes precedence when both are configured.

Success is a record of each setting’s state and duration. A blank local setting does not rule out a domain or RDS collection policy.

Step 2: Set the limit that matches the symptom

Choose the policy from the state you observed so you do not disable a useful control when the problem is a dropped connection.

The desktop disconnects after you stop moving the mouse

Open Set time limit for active but idle Remote Desktop Services sessions, select Disabled or set the idle limit to Never, and apply the change. If you need an inactivity control, use a longer value. Microsoft says an enabled policy warns two minutes before disconnecting an idle session.

The desktop disconnects after the same total duration every time

Open Set time limit for active Remote Desktop Services sessions. Set it to Never or choose a duration longer than the longest planned work period. It counts total connected time, not just time without input.

Programs stop after you close the RDP window

Closing the RDP client normally leaves the Windows session disconnected. Set Set time limit for disconnected sessions to Never when it must remain available; otherwise choose a retention period longer than your longest gap between logins.

The message says the session ended or the desktop is gone

Check End session when time limits are reached. When enabled, Windows logs off a session that reaches its active or idle limit. Set it to Disabled or Not configured if reconnection is the goal.

Safe values for bots and EAs

An RDP idle timer measures user input, not whether a program is busy. A bot or MT4/MT5 EA can be working while Windows considers the session idle. For a single-user private RDP, use this starting point:

WorkloadIdle limitActive limitDisconnected limitEnd session
Bot or EA that must keep its desktop sessionNeverNeverNeverDisabled or Not configured
Occasional administration30–60 minutes, if requiredNeverA period longer than your normal gapDisabled or Not configured
Multiple users on a managed serverFollow the organization’s policyFollow the organization’s policyFollow the organization’s policyFollow the organization’s policy

“Never” removes that Group Policy limit; it does not make the network permanent or override another administrator policy. If your organization requires idle logoff, follow that rule and document any separate automation account.

Step 3: Cross-check the registry values

Group Policy is the safer place to make the change, but the registry can explain a confusing result. Policy-backed values are commonly under:

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

The important value names are:

Registry valueMeaningUnit
MaxIdleTimeMaximum time with no keyboard or mouse inputMilliseconds
MaxConnectionTimeMaximum total connected timeMilliseconds
MaxDisconnectionTimeMaximum time a disconnected session remains activeMilliseconds
fResetBrokenWhether a timed-out session is ended instead of disconnectedPolicy flag

Computer policy is under HKEY_LOCAL_MACHINE, user policy under HKEY_CURRENT_USER, and policy values take precedence. For the first two timers, Microsoft documents REG_DWORD value 0 as unlimited. Do not overwrite a domain-managed value by hand.

To see which policy is actually applied, open an elevated Command Prompt and run:

gpresult /h "%USERPROFILE%\Desktop\gp-result.html"

Open the report and search for Session Time Limits. If it shows a domain setting, change that policy at its source. After a registry test, run gpupdate /force, reconnect, and confirm the result.

Step 4: Apply and verify the change

Verification proves the session state changed after the policy refresh.

  1. In an elevated Command Prompt, run gpupdate /force and wait for it to finish.
  2. Save open work, close the RDP client, and reconnect. Microsoft says reconnecting or logging off and on may be required.
  3. Run qwinsta to view the session state. Your session should show as active while connected and disconnected after the client closes, not logged off immediately.
  4. For an idle-limit test, leave the session untouched longer than the configured value. If the limit is enabled, look for the warning before the disconnect.
  5. For a disconnected-limit test, close the client and reconnect before the retention period ends. Confirm that the same desktop and running program are present.

If a test fails, record the message, elapsed time, qwinsta state, and applied policy from gpresult. Those details usually identify the responsible limit.

Ending versus disconnecting a session

Disconnecting keeps the session and its programs on the server for reconnection. Signing out or ending the session closes programs and removes the interactive session.

That is why clicking the RDP window’s close button is not the same as choosing Sign out inside Windows. For a longer explanation of preserving work after closing the client, see Keep Programs Running After Closing RDP.

If the session is logged off despite correct limits, check End session when time limits are reached, user-session settings, scheduled maintenance, and RDS collection settings. A short disconnected limit can make a network drop look like a logoff.

When the problem is the network instead

Policy timeouts are predictable. Network disconnects are more likely when the window drops while you type, timing changes, or there is no timeout warning.

Check the client network, VPN, Wi-Fi, firewall path, and server resources. If the server uses the default listener, test the port from Windows:

Test-NetConnection -ComputerName YOUR_SERVER_IP -Port 3389

A successful port test does not prove the full session is healthy, but a failed test points to connectivity or filtering. For a slow desktop, use the Remote Desktop slow or laggy troubleshooting checklist. For clipboard problems, see How to Fix Copy-Paste Not Working in RDP.

The Microsoft guide on unexpected RDS session locks or disconnections separates policy timeouts from locks and network behavior. Use the message and timing first.

Troubleshooting checklist

  • Same delay every time: inspect MaxIdleTime, MaxConnectionTime, and the matching Group Policy setting.
  • Disconnect after closing the client: inspect MaxDisconnectionTime and whether the session is immediately ended.
  • Logoff instead of reconnectable disconnect: inspect fResetBroken and End session when time limits are reached.
  • Settings keep reverting: check domain policy and the gpresult report.
  • No predictable timing and no warning: investigate the client or network path.

FAQ

What is the default RDP idle timeout?

When the active-but-idle policy is not configured, Microsoft documents no Group Policy time limit, so the session can remain idle indefinitely. A domain or security setting can still affect it.

How do I stop RDP from disconnecting when idle?

Set Set time limit for active but idle Remote Desktop Services sessions to Disabled or Never. Run gpupdate /force, reconnect, and check for a domain override.

Does closing RDP stop a running bot or EA?

Closing the client normally disconnects rather than signs you out. A bot or EA can continue until the disconnected-session or end-session policy removes it.

Why does RDP disconnect at random times?

Random drops without a repeatable interval are more consistent with network or client problems. Check the message and connection path before changing time limits.

What is the difference between RDP disconnect and logoff?

A disconnect leaves the session available for reconnection. A logoff closes its programs, so an end action can cause loss of unsaved work.

Samrat Ghosh
Written by

Samrat Ghosh

Founder & Infrastructure Engineer

Samrat Ghosh is the founder of VPSLake, where he builds and runs the remote desktop and VPS hosting infrastructure the company is built on. He writes hands-on guides about RDP, Windows Server, VPS management and secure remote access - the practical documentation he wishes had…

Previous Article

How to Install LAMP Stack with MariaDB on Ubuntu 26.04

Next Article

How to Install Landing CMS on AlmaLinux 8 with LAMP

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Subscribe to our Newsletter

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨