Forum Discussion
Idle time out GPO for Remote Desktop Services sessions not working in Windows 2019 servers
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.
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