How to Automatically Log off Idle Remote Desktop Sessions or keep RDP sessions alive in Windows
How can I force the server to log off the idle RDP session automatically? An idle or inactive session will also consume precious CPU resources and memory. When the number of concurrent connections has reached the limit, your best bet is to kick out idle users. In this tutorial we’ll show you how to use group policy to configure Windows to automatically log off idle remote desktop sessions.
Automatically Log off Idle Remote Desktop Sessions in Windows
1. Open the Local Group Policy Editor and browse to:
Press the Windows key + R to open the Run box.
Type gpedit.msc and press Enter.
Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Session Time Limits
In the right panel, double-click the “Set time limit for active but idle Remote Desktop Services sessions” policy.
2. Change it to Enabled, then set the desired amount of time in the drop-down list right below. Click Apply and then OK. Reboot your computer to put the policy into effect.
3. When any RDP user is idle for the group policy specified amount of time, they will receive the following warning:
“Session has been idle over its time limit. It will be disconnected in 2 minutes. Press any key now to continue session.”
You have the chance to click OK to extend the session. Otherwise, the idle session will log off automatically two minutes later.
How to keep the remote desktop sessions alive?
It’s irritating enough for the RDP users to face RDP session disconnects frequently. Here we summarize 2 quick fixes to help you keep the Remote Desktop session alive. Or you can switch to a third-party remote desktop software with stable performance.
Way 1. Adjust time limit in Group Policy Editor
Typically, the session timeout is 15 minutes but it could be depended on your security policy. Therefore, we can reset the time limit so that the RDP session won’t be limited by time.
Step 1. Press Win + R to invoke the Run dialog box. Type in “gpedit.msc” and hit “OK“ to open Registry Editor.
Step 2. Navigation:
Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Session Time Limits.
Find the three settings on the right pane:
- Set time limit for disconnected sessions
- Set time limit for active but idle Remote Desktop Services session
- Set time limit for active Remote Desktop Services session
Step 3. Click on “Set time limit for disconnected sessions”, tick “Enabled” and then select ”Never” beside “End a disconnected session”. Click on “OK”.
Step 4. And then click on “Set time limit for active but idle Remote Desktop Services session”, tick “Enabled“ and then select “Never“. Click on “OK”.
Step 5. Click on “Set time limit for active Remote Desktop Services session”, select “Enabled” and then choose “Never“. Click on “OK”.
Way 2. Add a registry key
Adding a registry key to keep the RDP session alive is another useful solution to fix “the RDP disconnects or freezes”. Keep reading to get concrete guides.
Step 1. Press Win + R and then enter “regedit”, and then press the “Enter” key.
Step 2. Navigation: Computer\HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server
Right-click and click on “New” > “DWORD (32-bit) Value”.
Step 3. Name it “KeepAliveEnable“. Double-click on it, set the value data to 1, and tick “Decimal”. Click on “OK“.
Step 4. Once the action is completed, reboot the VPS.