起因:一台服务器 2016版本,每当退出远程桌面后,过一段时间,用户所有的进程就会自动关闭,导致后台运行的任务出现异常。
运行 gpedit.msc, 根据以下资料设置后,记得重启,不然不会生效
前三个选项 enable 都选 never
后两个 disable
我们可以尝试以下设置,来自动关闭断开连接(disconnected)的远程桌面会话:
1. AD与环境中,在用户账户属性-会话中,关闭已经断开连接的会话(End a disconnected session)一栏中,设置时间限制。
2. 组策略,如果是AD与环境,考虑到组策略优先级,请通过AD域策略设置:
Computer Configuration -》 Admin Templates -》 Windows Components -》 Remote Desktop Services -》 Remote Desktop Session Host -》 Session Time Limits -》 Set time limit for disconnect sessions
完成更改后,如果方便的话,请重启计算机并确认更改结果。
The settings of RDP session timeouts are located in the following GPO section Computer Configuration -> Policies -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Session Time Limits. The following Remote Desktop timeout settings are available:
Set time limit for disconnected session;
Set time limit for active but idle Remote Desktop Services sessions — the policy allows to end idle RDP sessions that have no user input (like moving a mouse or typing something on a keyboard);
Set time limit for active Remote Desktop Services sessions — it is the maximum time of any RDP session (even an active one), after which it switches to the disconnected state;
End Session when time limits are reached — sets the time, after which an RDP session will be terminated (logoff) instead of disconnecting it;
Set time limit for logoff of RemoteApp sessions.
参考
https://woshub.com/remote-desktop-session-time-limit/
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc754272(v=ws.11)?redirectedfrom=MSDN
有视频
https://community.spiceworks.com/topic/2012743-auto-logoff-disconnected-sessions
https://social.technet.microsoft.com/Forums/projectserver/en-US/54cc5198-37b1-4993-8975-693e97387519/windows-server-2012-r2?forum=windowsserversystemzhchs