tsites
tsites computer tuition, website design, network security
software

delayedlogoff 0.1

delayedlogoff does what the name suggests - after a delay of 2 hours, it will log-off the corresponding user's Windows session. You can use this if you have multiple users on the same computer, but for some reason they never seem able to choose 'log out' when they've finished.

About

This background program logs the user off after 2 hours of inactivity. The computer is deemed inactive if the mouse has not moved for all this time.

So, if the mouse moves at all for this logged in user, the timer goes back to 2 hours. When the timer reaches 0, a logout of the user occurs (as if the user had gone to the start menu and chosen log out/log off themselves).

It will only log off the user who runs the program, not all users at once.

So if two users are logged in, and the second user is still using the computer, user 2 will carry on working like nothing had happened. The first inactive user gets logged out in the background silently because on THEIR session, the mouse hasn't moved (even though user 2 might be moving the mouse all over the place).

I was thinking of how to better explain this. Please see the diagram below.

Why would I need this?

Here's a likely, and all too common scenario:

Any drawbacks or reasons not to run this?

Are there any drawbacks to logging a user off without asking? - yes... if they've not saved their work, it could be lost, but that's their fault. I mean, if they've left themselves logged on there's nothing stopping someone coming along and resetting the PC anyway. So I take the approach that walking off and not logging out, leaving someone else to choose 'switch users' and therefore being left with a slow/unusable computer is just bad practice. It's ultimately the users responsibility to save their own work. This might sound harsh, but I remember learning this at school back when we had Windows NT (ask your parents/grandparents) (30 years ago, when I was only 15 years old).

delayedlogoff uses as little memory as I could get away with (under 6mb, which by modern standards is small). It typically uses 0.01% cpu in the background.

How do I install this?

Put it in the following location for all users startup folder:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

It runs in the same security context as the currently logged in user, so shouldn't need any special permissions.

64bit Windows 10 self-contained binary. (Will probably work on Windows 7 - Untested though)

Download

Download delayedlogoff 0.1 (5.3MB) for Windows

(This is tested on Windows 10. I haven't tried it on Windows 7 yet)

More in-depth information (you don't have to read this)

Yes, there's other 'solutions' to this online, but my opinion was I'd rather write my own so I knew it was free of malware/spyware. I also looked at doing this through a scheduled task using Group Policy: Works fine in Windows 7, but I can't get Windows 10 to actually listen to the GPO.

My first approach, before I made delayedlogoff, was to see if there were any existing group policies that Windows 10 would listen to regarding scheduled log off. There's stuff built in for remote desktop session timeouts, but not for local workstation logins. Unbelievable really - I guess Microsoft didn't think of that.

My other approach, before writing this, was to have a batch file (.bat) run at login and create the scheduled log off task. This method briefly displayed an ugly command prompt window (not what I wanted, even though I specified it should run silently) and it also logged out all users, not just the one that had wandered off.

delayedlogoff uses more memory than a scheduled task does, so I recommend doing that with Windows 7 at least. delayedlogoff could be seen as using a sledgehammer to crack a nut... but it works.

Version history

version 0.1 - test release

System requirements

Tested with Windows 10 (up to the 1709 update)... Who knows - they might break it with one of their monthly patches. Unsure about Windows 7 compatibility. If you are reading this (and feel like you want to test it) please feel free! - don't blame me though.

If you have any suggestions, please get in touch via email. Many thanks.

Tom.

tom@tsites.co.uk