Get the Network Administrators tool pack

Subscribe to our 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

Recent Posts



Automatically logoff inactive users

Post image for Automatically logoff inactive users

by Steve Wiseman on November 16, 2011 · 100 comments

in Tips,Tools,Utility


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.

MS Word in the trash

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:

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

Related Articles:

{ 50 comments… read them below or add one }

1 Tracy November 16, 2011 at 2:32 pm

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.

2 Richard November 16, 2011 at 3:01 pm

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—?


3 Steve Wiseman November 16, 2011 at 3:52 pm

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

4 Travis Foschini November 16, 2011 at 8:34 pm

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)?

5 Steve Wiseman November 17, 2011 at 12:09 am

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.

6 puli November 17, 2011 at 1:07 am

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,

7 Steve Wiseman November 17, 2011 at 8:30 am

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.

8 Larry November 18, 2011 at 11:35 am

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……

9 Larry November 18, 2011 at 11:36 am

RESTART and a SHUTDOWN would be and excellent additon +1 that.

10 Scott December 8, 2011 at 1:18 pm

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,

11 Steve Wiseman December 8, 2011 at 2:17 pm

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!

12 Scott December 8, 2011 at 3:36 pm

excellent, thanks allot…will do :).

13 Sesan Lawal March 1, 2012 at 5:30 am

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.

14 Steve Wiseman March 1, 2012 at 11:18 am

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.

15 Jeremy Simmons June 14, 2012 at 12:04 pm

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!


16 Steve Wiseman June 14, 2012 at 12:10 pm

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?

17 Jeremy Simmons June 14, 2012 at 12:38 pm

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.

18 Steve Wiseman June 14, 2012 at 2:03 pm

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.

19 Jeremy Simmons June 14, 2012 at 2:08 pm

hmm…we can give it a shot..thanks again…this program is a lifesaver either way!

20 Tim August 2, 2012 at 11:15 am

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!

21 Shane August 3, 2012 at 2:58 am

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.

22 Steve Wiseman August 3, 2012 at 11:04 am

Hi Shane…no. The only way to cancel is to kill the process.

23 Steve Wiseman August 3, 2012 at 11:14 am

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.

24 Jordan Novick August 8, 2012 at 2:14 pm

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.


25 Jordan Novick August 8, 2012 at 3:35 pm

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…”

26 Steve Wiseman August 8, 2012 at 7:06 pm

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.

27 Andy August 30, 2012 at 10:47 am

Any way to stack this to accomplish the following:
Idle for 15mins = logoff
Idle for 30mins = shutdown

28 Steve Wiseman August 31, 2012 at 1:34 am

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.

29 supermario September 9, 2012 at 4:41 am

Nice free command line tool! For an group policy based alternative with more options you can take a look at AutoLogoff. Don’t know if this is appreciated and if deleted.. it’s ok.

30 Colin Atkinson September 11, 2012 at 9:41 am

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.

31 Jeremy September 26, 2012 at 2:40 pm

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?


32 Steve Wiseman September 26, 2012 at 3:01 pm

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?



33 Jeremy September 26, 2012 at 3:05 pm

Its the currently logged in user.

34 Jeremy October 1, 2012 at 2:58 pm

Anymore advice?

35 DG October 2, 2012 at 7:51 am

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?


36 Steve Wiseman October 2, 2012 at 11:32 am

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?



37 DG October 2, 2012 at 11:45 am

I’ve tried it with and without the “start” command.

38 Jeremy October 2, 2012 at 2:07 pm

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!

39 Jeremy October 2, 2012 at 2:10 pm

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.

40 Steve Wiseman October 2, 2012 at 3:12 pm

Jeremy, and DG – What type of logon script is the users startup folder…netlogon?

That could have an effect…there might be permissions issues involved with forcing the logoff.

41 Jeremy October 2, 2012 at 3:39 pm

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.

42 DG October 2, 2012 at 4:50 pm

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.

43 Steve Enemark October 2, 2012 at 6:43 pm

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.

44 Steve Wiseman October 2, 2012 at 8:30 pm

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?



45 DG October 3, 2012 at 7:59 am

User policy.

46 Jeremy October 3, 2012 at 11:38 am

Mine is a logon script so its a user policy not a computer policy.

47 Jeremy October 3, 2012 at 12:28 pm

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

48 Jeremy October 3, 2012 at 12:31 pm

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!

49 Steve Wiseman October 3, 2012 at 2:26 pm

Good info Jeremy, Thanks for telling us what caused the issue for you.

Where are you putting your exe file DG?



50 Jeremy October 3, 2012 at 5:13 pm


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.

Leave a Comment

Category Links - Windows Forum - Exchange Forum