Log off a locked computer after a certain period of time

I've been searching the net for a software or a tool that would log off a locked computer after a certain time but came up with nothing usable this far.

There's plenty of tools for logging off a user after a predefined time of inactivity, such as winexit.scr which comes with the windows server 2003 resource kit, but these don't match my requirements.

The tool should log off the user after a period of time that the computer is _locked_. So if the user locks the computer it would log it off after say 15 minutes. All the tools I've found don't come with this feature, they log the user off after the defined time no matter if the computer is locked or not.

Any suggestions for this?
Who is Participating?
KenneniahConnect With a Mentor Commented:
Best way I can think of offhand would be to use schtasks in combination with screen saver policy.
Basically you'd set group policy to have the screen saver run after 15 mins (or whatever time you want) of inactivity and lock the workstation. Then you'd use schtasks with the /ONIDLE to schedule shutdown.exe or psshutdown after 30mins of idle time.

This wouldn't do exactly what you want, but what it would work as in the following.
If user walks away from workstation, after 15 mins, computer would lock, then 15mins later would logoff.
If user locks the workstation, 30 mins later user would log off.

It's not based solely on Locked time, but might come close to what you desire.
Danny ChildIT ManagerCommented:
psshutdown with the -o switch will force a logoff of the user, and the -f switch will force apps to close (possibly losing unsaved documents).

Not sure how you're gonna detect when a PC is locked though...

and short of running this in a scripted loop to test the pc every 5 mins or so, I can't think of a good way to apply it.
helppariAuthor Commented:
Thanks for your answers. Psshutdown seems to be a capable tool of logging the user out.

Still, I'd need the logoff to base on the time the computer has been locked, not for the time of inactivity. Is there really no way to do this?

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Danny ChildIT ManagerCommented:
doesn't the time of being locked = the time of inactivity, by definition?  Or are you considering background processes that run while a pc may be locked?
Danny ChildIT ManagerCommented:
To add to Kenneniah's top info above, here's a link on schtasks.exe

helppariAuthor Commented:
The time of being locked can very well be equal to the time of the computer to be locked but not necessarily. Say a user follows the lesson or reads a book in front of the computer and because of that doesn't touch the computer for a while.

This is why I'd need the logoff to base on the time of the computer being locked.  
Not built into Windows XP at least. It doesn't have a timer for how long the workstation has been locked. Vista's Task Scheduler has triggers that can be set, including "On workstation lock", but unfortunately this does not exist in XP or 2003.

I'm not aware of any third party schedulers that have this ability, but it's always possible there is one out there.
helppariAuthor Commented:
Ok. I'll have to manage with these then. Thanks guys.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.