Forum Discussion

A-nony-mouse's avatar
A-nony-mouse
Copper Contributor
Feb 07, 2024

Remote desktop sessions ends after idle 15 minutes

GPO and registry entries on the target machine show no idle time max. I don't understand why it ends the session every time after 15 minutes of being disconnected. All my programs close and I have to open up everything.

  • A-nony-mouse's avatar
    A-nony-mouse
    Copper Contributor
    I wrote a script to restart the terminal services host every 15 minutes using Windows Task Scheduler.
    That prevents the timeout from being reached. It knocks out my remote desktop session, but it reconnects on its own. I just have to enter my password. Terrible, but it beats having all my programs close.

    $termservices_restart_info = tasklist /svc /fi "SERVICES eq TermService" /fo csv | ConvertFrom-Csv | Select-Object -First 1
    if ($termservices_restart_info.Services -eq "TermService") {
    Write-Host $termservices_restart_info.PID
    taskkill /F /PID $termservices_restart_info.PID
    net start termservice
    }

Resources