Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

How can I force a computer to sign out automatically?


Do have any idea how to force the computer to log off? The situation is that
at work people don’t log off and leave sensitive information on their

It’s funny, I ran into exactly this situation years ago. I was walking by my
boss’s office and happened to see some interesting information on his screen.
Some very interesting information.

It was performance review time, and on his screen was a spreadsheet with all
the review and salary information.

Needless to say when he got back we solved that problem quickly, and the
same solution might well apply here.

Become a Patron of Ask Leo! and go ad-free!

The quickest solution: enable a screen saver, and ensure that “On
resume, display Welcome screen
” is selected:

Screen Saver settings

After the screen saver kicks in when the user returns to their computer
they’ll be presented with the Windows login screen. Assuming their account has
a password, they’ll have to enter the password to return to whatever it was
they were doing and see whatever it was they had on their screen.

It’s not a true log-off, but it does solve the problem of anyone walking by
being able to see or access what’s on the computer. And it’s exactly the
solution my boss implemented on his own machine.

(And, no, pointing that out to my boss didn’t hurt or help me in that
performance review :-) )

“The quickest solution: enable a screen saver”

If you want to force a true log-off, I’m not aware of a way to make it
happen on inactivity, but then you probably don’t want it to happen that way
anyway. A true log-off will close all open applications and possibly lose any
unsaved data that the user had in those applications.

I do, in one case, force a log off on one of my machines in the middle of
the night. I do that by using the “psshutdown” command:

psshutdown -o -f

“-o” logs off the console user, and “-f” forces any running applications to
close. Psshutdown is one of the sysinternals utilities and can be downloaded

Using the task scheduler one could schedule psshutdown to be run at a
specific time each night, for example, to force a logoff. That doesn’t solve
the problem during the day, but it does force the log off.

Do this

Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

I'll see you there!

8 comments on “How can I force a computer to sign out automatically?”

  1. There is a very similar way to do the same thing on a Mac (with Mac OS X 10.4) : go to System Preferences/Security and check the ‘Require password to wake this computer from sleep or screen saver’ box.
    You can add something : in Utilities/Keychain Access, open the Preferences and check ‘Show status in menu bar’. It will allow you to open the screen saver from the menu bar.

  2. Wow — sorry about those typos:

    Another 2 cents: The WinExit screensaver (I believe part of the WinNT4 or Win2k resource kits) will log the user off after a configurable period of inactivity. I’ve used it in a few applications of shared computers. Not sure if it’s compatible with WinXP.

  3. I managed to get it to force a logoff. It involves a registry edit but there is a key in the registry that controls the screensaver. Edit the screensaver.scr entry (Somewhere in the Users’s settings\Control\Desktop key) and make it point to A SHORTCUT or BATCH FILE.

    In the shortcut or batch file, type in “shutdown -l” and if you have done it correctly, after the specified screensaver delay the user will be logged off.

    You cannot put “shutdown -l” straigth into the registry, I don’t know why but I tried it myself and it didn’t work.

    Also this is a forced logoff so any unsaved work WILL be lost. If you use this trick do not leave the computer with anything unsaved otherwise it will be lost.

    Hope this is helpful,

  4. Hi Leo, why wouldn’t you just use the “Window” “L” command to take you straight to the Log In screen? Its so simple and at least gives you the first layer of protection and it is immediate, i.e. you don’t have to wait for a Screen Saver . Certainly your boss could and should have used it! Mike.

    a) you have to remember to do it, and b) my example actually pre-dates the Windows key :-). Ctrl+Alt+Del might have done it at the time, but again – you have to remember to do it. Distraction is a problem.

    – Leo

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.