Create an auto-logoff script for Windows 7

One Use Case

I’m not really sure how useful this is to other folks, but we’re in a primarily Mac environment and have a Windows computer joined to Active Directory that’s handy to use for people’s password changes.

Once people have changed their passwords… no need to be logged in any more, so this just logs people out shortly after they’ve changed their passwords.

You may, of course, find other uses for this, and you can adapt the script as necessary.

Create the script

Using Windows’ Notepad (or another downloaded text editor like Notepad++), create a new document and paste this code in:

:: Don’t display commands
@echo off

:: Display message to user
echo You will be logged out at the end of the countdown.
echo Close this window if you want to stay logged in.

:: Wait 10 seconds
timeout /t 10

:: Log out
shutdown /l

Save the file as autologout.bat on your desktop or someone else you can easily reference later.

Test the script

Now find the autologout.bat file you saved and double-click it. It should have a countdown and then log you out.

Move the script to the startup folder for every user

If the script worked, go to C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

Then, copy or move your autologout.bat file to that new location.

It should now log people out 10 seconds after they log in.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.