Change RDP Session Time Out
The default session timeout for Remote Desktop Protocol (RDP) sessions in Windows can vary depending on the version of Windows and any specific configurations set on the system. In general, the default session timeout for RDP is around 10 minutes of idle time.
To configure the session timeout to 2 hours, you can follow these steps:
Connect to your Windows desktop running via RDP.
Open the Local Group Policy Editor by pressing the Windows key + R, typing "gpedit.msc" (without quotes), and hitting Enter.
In the Local Group Policy Editor window, navigate to the following path on the left-hand side: Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Session Time Limits.
On the right-hand side, locate the policy named "Set time limit for active but idle Remote Desktop Services sessions" and double-click on it.
In the policy settings window that appears, select the "Enabled" option.
Set the time limit to 120 minutes (2 hours) by entering "120" in the "Minutes" field.
Click "Apply" and then "OK" to save the changes.
Close the Local Group Policy Editor.
After applying these settings, RDP sessions should have a timeout of 2 hours of inactivity. Remember to test the new session timeout to ensure it functions as expected.
Note: Modifying group policies and system configurations can have implications on system behavior. It's always recommended to thoroughly test any changes in a non-production environment or consult with your system administrator before making modifications.
Here's a PowerShell script that can be used to configure the RDP session timeout to 2 hours:
To use this script, follow these steps:
Open a text editor and paste the above script into a new file.
Save the file with a
.ps1
extension (e.g.,configure-session-timeout.ps1
).Open PowerShell with administrative privileges.
Navigate to the directory where you saved the script.
Run the script by executing the command
.\configure-session-timeout.ps1
.
The script will modify the local Group Policy object to set the RDP session timeout to 2 hours (120 minutes) and force an update of the Group Policy settings using gpupdate /force
. Please note that modifying group policies can have system-wide effects, so it's recommended to run this script on a test environment or consult with your system administrator before applying it to production systems.
Last updated
Was this helpful?