For that purpose I've created small AutoIt script. It works in loop, periodically cheking the
_Timer_GetIdleTime() function value from
Timers.au3, if it becomes greater than certain amount of time, the script executes
tsdiscon.exe, and PC exits to welcome screen.
Here is the code I have used:
const $setpoint = 900000 ; switch by idle time setpoint 900000 ms = 15 minutes
const $interval = 60000 ; check interval 60000 ms = 1 minute
const $tsdisconpath = "C:\WINDOWS\System32\tsdiscon.exe" ; specify the actual path for your OS, this might need to be changed
; eg on my Win 7 HB x64 the file full path is C:\WINDOWS\winsxs\amd64_microsoft-windows-t..es-commandlinetools_31bf3856ad364e35_6.1.7601.17514_none_42d65ed50fa3c682\tsdiscon.exe
$disconnected = false
$idle = 0
$prev = $idle
$idle = _Timer_GetIdleTime()
if $disconnected and $prev > $idle then ; user has logged in again
$disconnected = false ; reset state
if $idle > $setpoint and not $disconnected then
run($tsdisconpath, "") ; exit to welcome screen
$disconnected = true
$idle = 0
You have to specify the actual path to the file
tsdiscon.exe for your OS.
I compiled this code to exe with Aut2Exe (it available both in full install and portable AutoIt), and put to autorun. AutoIt version was 18.104.22.168.
If you want to exit to the Lock screen instead of Welcome screen, then you use
const $tsdisconpath = "RunDll32.exe user32.dll,LockWorkStation
A fly in an ointment. I have to say about petty drawbacks of the script you may encounter. Usually you do not touch mouse and keyboard while watching movies, so the script will suddenly exit at setpoint, and the movie will continue playback. Also I noticed when I wake up PC after hibernation and log on, for some reason the script detects that time is out, and exits.