I got a question from Tracy this week:
“Hi Steve. Love all the tools and tips you keep sending our way. Got a question. Is there any easy way to logoff a user when they are not active for say, 15 Minutes?”
I spoke with Tracy further to explain that forcing a logoff could cause data loss.
For example, a user has a Word document open and they walk away. Then boom the forced logoff happens and their document is gone.
In her case she needs it for public facing kiosks. If one of the technicians walks away, it leaves the system wide open.
Locking the workstation for this situation is bad too – since it makes it so the customer cannot use the machine.
Did some googling and found some hacks that used chopped up screen savers that would activate, and then call some logoff code.
Didn’t like that. So I had the team build a little app that would just logoff or lock idle users.
Here is how it works, you call the program like this:
idlelogoff.exe [timeout] [action]
timeout - The number of idle seconds before the action is taken
action - [logoff / lock / shutdown] You can lock, log the user off, shutdown or restart the workstation.
If you wanted a user to get booted off after 5 minutes (300 Seconds) of no activity, You would call it like this:
idlelogoff.exe 300 LOGOFF
If you wanted it to lock the workstation after 30 seconds of no activity this would do the trick
idlelogoff.exe 30 LOCK
If you wanted it to shutdown the workstation after 30 seconds of no activity this would do it:
idlelogoff.exe 30 SHUTDOWN
It has some sanity checking for the timeout. Anything less than 10 seconds is set to 10 seconds.
Call it from the users startup script to make sure it is active while they are logged in.
Get it from our downloads page:
http://www.intelliadmin.com/index.php/downloads/
It is free for personal and commercial use.
One more thing…Subscribe to my newsletter and get 11 free network administrator tools, plus a 30 page user guide so you can get the most out of them. Click Here to get your free tools
{ 50 comments… read them below or add one }
Thanks you Steve! Can’t believe you guys built this. I never expected that at all.
Already tried it on a few of our machines, and it is working great so far.
Hi-Some of us are still learning. Instead of saying “Here is how it works, you call the program like this:”—how about providing a real example? Some kind of script–or—?
Thanks!
Hello Richard,
A BAT script would look just like the above examples. Create a file called logon.bat and then inside it you would have this:
idlelogoff.exe 30 LOGOUT
This assumes that the logon.bat is in the same folder as idlelogoff.exe
Thx for the freebie.
Can you explain what constitutes an an active session? keyboard, mouse, display changes, etc?
Had you considered pointing Tracey to more elaborate soutions such as transparent screensavers or MS
Steady state (or the like)?
Active session = Keyboard or mouse movement. If the user does not move the mouse, or type on the keyboard it is considered idle.
Steady state, and the screen saver would both work in this situation as well…but if my memory is correct I believe the last time MS came out with a logoff screen saver was with the Windows 2000 resource kit. Not even sure if it works with the newer versions of Windows.
HI all,
Is there any script that enforce the system shutdown while idle..I tried with windows schedule but this some time works and some time doesn’t work..If any scrips please share it.
thank you,
PUli.
You know Puli….this little program of ours could be updated to do just that…hmm. I will look into it and see how hard it is to add a RESTART and a SHUTDOWN action.
This is awesome!
Not to complicate things; but perhaps a little timer somewhere to display in how much time the computer will be logged off, kind of a visual warning in case your sitting there and waiting for something, but dont really want to logout. Of course you can always set the screen saver a few minutes prior to the logoff……
…..and
RESTART and a SHUTDOWN would be and excellent additon +1 that.
hi, is it possible to run this as a service? because when I launch this via a batch file, it will only work if the batch command window stays open…and if the user closes their application, and where the session would normally log off and close, it doesn’t, due to the batch window being left open, i think…any help would be greatly appreciated, as I might just be doing something wrong. thanks,
Hi there Scott,
Looks like it was a bug. It tries to attach to the console, even when running…so in some situations if the bat file is closed, it will close too.
Download it again and it should work…should have a date stamp of 12/8/11
Let me know if this fixes it for you. Thanks!
excellent, thanks allot…will do :).
Hi steve, the timed shutdown was what i was looking for when someone mentioned it in the responses: has it been updated now? You know around here it takes time to download minor MB because of the average speed of 7 Mb\s, take for example an overnight download can averagely avail about 200 MB only. That is africa for you! So for downloads not up to that and will like my pc to go off at a specified time, how good to have this idlelogoff do the same. thanks for the freebies.
Hello Sesan,
So sorry I forgot about this. I just went in and updated the code, and uploaded the new version to the website. Make sure the banner shows v1.1 when running it from the command line (To be sure you have the new version).
If you downloaded the earlier version, make sure you clear your download cache.
It seems you cannot run this with an account other than the account that is currently logged in. I need to run this so the users cant go in and kill the process. Is there a way for this to be done? Thanks!
v1.1
With this version it is not possible. We would need to re-design it as a service…have it look for users that are logging in…and then finally reach into that session and execute the program.
What about using group policy to restrict access to task manager?
I suggested that to my Lead however, we need to provide them with the option to kill processes that they own. Everything else is locked down.
One trick I use in these situations is rename the EXE to make it harder to find. For example, you could call it svchost.exe They would have a heck of a time finding it in task manager…but not sure if some AV software will think it is a virus then.
hmm…we can give it a shot..thanks again…this program is a lifesaver either way!
This is very interesting. I have an issue with Terminal Server users whom never log off. Could this be used for logging off individual TS sessions after a stated period of inactivity? Thanks!
hey Steve,
awesome application
Just wondering if there was a way of allowing the user to cancel the log off.
we have an educational lab environment where students may be logged in but spending time with their attention directed else where but still using the workstation.
Hi Shane…no. The only way to cancel is to kill the process.
It should work for a TS session. There are cases where a TS session is still logged on but ‘frozen’ This usually happens when a user simply closes their RDP client without logging off…in that situation I don’t think it would work.
Will anyone provide me more details on how exactly you’re deploying this through GP? Are you deploying it through Computer Config (Startup) or User Config (Logon)? I can get it to run at startup (confirmed running process in task manager) but it doesn’t do anything. Either the parameters (300 LOGOFF) aren’t getting passed or I have a permissions issue.
Thanks,
Jordan
After RTFMing again I realized that this would probably only work when deployed as a user logon script and not a computer startup script. It’s now working very well for me that way. However, we’d really like to be able to deploy this only to certain machines regardless of who logs on, i.e. only to a public computer lab. Anyone know of a clean way to accomplish this. Maybe as a scheduled task?
Steve – Excellent app! You may want to change your text above from “Call it from the users startup script…” to “Call it from the users logon script…”
Hello Jordan,
This script would need to run under user config..otherwise it would not run in the correct context…and probably would not be able to log that user off.
Any way to stack this to accomplish the following:
Idle for 15mins = logoff
Idle for 30mins = shutdown
Thanks!
Hi Andy,
You would just need to call the app twice. Like this in a bat file:
start idlelogoff.exe 900 LOGOFF
start idlelogoff.exe 1800 SHUTDOWN
The ‘start’ command allows the app to start, and the bat file won’t wait for it.
Nice free command line tool! For an group policy based alternative with more options you can take a look at AutoLogoff. http://wizardsoft.nl/autologoff/autologoff.html Don’t know if this is appreciated and if deleted.. it’s ok.
This tool is great.
One quick question though. I have this setup using group policy so the .exe is copied from a server, to the C:\. Then a shortcut of the .exe is placed in the startup folder with 1800 LOGOFF. However, when the machine logs in, I am prompted for approval to run this software. Can I run this silently? I have tried .exe /S 1800 LOGOFF but it looks as thoug the software does not load at all with this command.
Thanks
I have had the .exe pushed to all my machines. I also pushed a batch file that contains the following.
@echo off
cd C:\Program Files\RISALO
RISALO.exe 14400 logoff
I am currently using as a logon script which starts the process fine but will never actually logoff a user. If I can the batch file manually it works just fine. Any thoughts?
-J
When you launch the process from the logon script…I want you go into the task manager. Who owns the process? Is it the currently logged in user, or system?
Thanks,
Steve
Its the currently logged in user.
Anymore advice?
When I use idlelogoff 600 logoff, I do not get an interactive desktop (just a blue background and mouse pointer). After the 600 seconds, the session logs out as it should and I get the login screen again. any idea why my desktop is not displaying properly?
Thanks,
Darin
To Jeremy, and DG
How are you calling this application in your script. If you don’t use the ‘start’ command it will cause your batch file to not run properly.
Like this:
start idlelogoff.exe 900 LOGOFF
Is that how you are running it from your script?
Thanks,
Steve
I’ve tried it with and without the “start” command.
Yes that is how I am doing it.
@echo off
cd C:\Program Files\RISALO
start RISALO.exe 10 logoff
I changed it to 10 seconds for testing and it still doesnt work. Without and without the start function the process still starts…But still no logoff. Thanks!
If I run the batch file manually it logs off like it should which is wierd…Both the process that starts at logon and when I run it manually are owned by the currently logged in user.
Jeremy, and DG – What type of logon script is this..group policy..in the users startup folder…netlogon?
That could have an effect…there might be permissions issues involved with forcing the logoff.
Its group policy in the logon script folder..the actual file path is crazy but its in the right place. I do not have it in the netlogon folder.
I’m calling it from a logon script within GP.
For me, the logoff functions properly, but I just don’t get an interactive desktop…just a blue background and mouse pointer.
It works great for me, as long as I’m only using one command (logoff, lock, etc). My batch file looks like this:
start idlelogoff.exe 30 LOCK
start idlelogoff.exe 60 LOGOFF
My pc logs off after 60 seconds, but it doesn’t lock.
Ok Good info from both of you…and thanks for the info Steve.
Is it a User Policy, or a Computer Policy that the script is running under?
Thanks,
Steve
User policy.
Mine is a logon script so its a user policy not a computer policy.
I changed my logon script to look like this and it works now. Obviously I had to move the location of the .exe to the location below too. I think there was some sort of permissions issue with it being under Program Files, I really dont know…Just happy its working! 😀
cd C:\”Documents and Settings”\”All Users”\RISALO
START RISALO.exe 14400 logoff
I really appreciate all the help too. I cant imagine most people being as dedicated to helping there “customers” especially since this is’nt a paid product. Thank you!
Good info Jeremy, Thanks for telling us what caused the issue for you.
Where are you putting your exe file DG?
Thanks,
Steve
@DG
Have you tried using two seperate batch files? I would make a few copies of the .exe and keep the original. Rename the copies to Autolock & Autologoff then have the two batch files call on their respective applications.
Let us know.