24.06.2025

How to Set RDP Session Timeouts in Windows Server to Prevent Session Loss

When working remotely over Remote Desktop Protocol (RDP), it’s crucial to ensure that background processes — such as programs, scripts, or macros — continue running even if the RDP session is interrupted. By default, Windows Server may terminate these processes when a session disconnects, which can lead to data loss or halted automation.

To prevent this, you need to configure RDP session timeouts via Remote Desktop Services (RDS) and Group Policy settings. This guide will walk you through the process step by step.

Install Remote Desktop Services Role

To manage session limits and enable related policies, you must first install the Remote Desktop Services role.

  1. Open Server Manager.
  2. Click Add Roles and Features.
  3. In the wizard, on the Before You Begin screen, check “Skip this page by default” (optional), then click Next.
  4. Choose Remote Desktop Services Installation and proceed.
  5. Select Multipoint Services as the deployment type (default).
  6. Choose the local server for installation.
  7. Check the box Restart the destination server automatically if required, then click Next or Install.
  8. Wait for the installation to complete.
The server may restart during the process. All active RDP connections will be closed without warning.

Once the setup completes and shows "Success", close the wizard.

2. Configure Group Policy for RDP Session Timeouts

You now need to adjust Group Policy settings to control how sessions behave when disconnected or idle.

Navigate to the following path:
Computer Configuration → Administrative Templates → Windows Components → Remote Desktop Services → Remote Desktop Session Host → Session Time Limits

Enable the Following Policies:

How to Edit a Policy

  1. Double-click a policy or right-click → Edit.
  2. In the new window, choose Enabled.
  3. Set the appropriate time frame (e.g., 15 minutes, 1 hour).
  4. Click OK.
  5. The actual timeout values depend on your organization's policies. A common setup is:

3. Finish and Apply the Policy

After configuring the policies:

  1. Close the Group Policy Editor.
  2. Apply the new settings with the command:
    gpupdate /force
  3. You may also reboot the server to ensure changes take effect.

That’s it — your RDP session timeouts are now configured to preserve background processes even after disconnection.

FAQ: RDP Session Timeouts