Forum Discussion
kpr208
May 23, 2022Copper Contributor
Idle time out GPO for Remote Desktop Services sessions not working in Windows 2019 servers
I have configured GPO to Set time limit for active but idle Remote Desktop Services sessions. Policy has been set to disconnect sessions which are idle for more than 3 hours. But I am getting warning...
tgellar
Feb 16, 2024Copper Contributor
Same problem for me for years now. I apply local user session settings and don't use group policy but have tested group policy settings with no success.
We upgraded from 2019 from 2012 where the local user session settings worked fine. I applied the same setting in Win 2019 where they failed.
- agoncalves1982Mar 08, 2024Copper Contributor
The only way I was able to log off was with a .bat script and another .ps1 (power shell)
.bat file
@echo off
PowerShell -Command "& {Start-Process PowerShell -ArgumentList '-ExecutionPolicy Bypass -File ""C:\Users\administrator\Documents\Script\Logoff.ps1""' -Verb RunAs}".ps1 file
$sessions = Get-RDUserSession | ? {$_.SessionState -eq "STATE_DISCONNECTED"}
foreach($session in $sessions) {
Invoke-RDUserLogoff -HostServer $session.HostServer -UnifiedSessionID $session.UnifiedSessionId -Force
}After that I created a shedule to call the .bat file which in turn executes the .ps1 file
Windows Server 2019
thanks