Calling IT people - Windows 7 - Force user log-off after set time of idle WITHOUT logon hours

Hey my IT people.

We want to have automated log off of systems after 3 hours, so that instead of asking everyone to exit the program that we need to patch during lunch, we can just do it at 11.

Does anyone have any ideas that doesn’t involve 3rd party software or especially Logon hours.
I was perusing Spiceworks but alas, pretty much nothing.

We’re on Windows 7 Pro

Task Scheduler maybe? Can’t remember if that can be pushed out on a Windows domain, or if you’d have to set it up manually on each machine…

1 Like

It’s a couple hundred machines. Task scheduler seems to be the best option, but I worry about the functionality. Gonna have to play with a test system for that. Blyat

Task scheduling can be pushed out via GPO and you can schedule a log off at idle state but im not sure what constitutes idle and it appears that whatever idle means task scheduler will execute immediately. You will have to play with a test system though. The computer may not go idle with some programs running.

You could force a screen saver and set that timeout via GPO as well, might be something there. If you just want every session to end at a specific time of day though I’m sure that would be much easier to automate.

1 Like

You could do a simple script with all your PC’s in it.

shutdown -l -t -m \COMPUTERNAME

Since you only need the program closed, instead of forcing a logoff (I would just force a reboot if that were the case) just use a script to go through all of the computers and kill the program.

Powershell is a good option assuming you have remote commands already set up.

Invoke-Command -ComputerName BobsWorkstation -ScriptBlock {Stop-Process -Name notepad}
That will be good for a single computer, since you have quite a few, put together a txt file with the computer names separated by line-breaks and use:
$names = Get-Content -Path "C:\scripts\names.txt"
Then just use $names in place of the actual computer’s name

If you have more than one .exe for the program you can put them all in with a coma
Stop-Process -Name notepad, EXEL, WINWORD