Howto: Automatically log in and lock your session so things load faster

If you don’t set a password on your Windows user account, you get logged in straight away, and things like MSN and your email notifier start loading immediately. If you have a password, things stop dead until you’ve sat down and typed it in to log in, in which case you could still have a minute or two to wait before things are usable again.

What I dreamed up the other day was this: Is there a way to log yourself in automatically, but immediately lock your session, so you still need a password to use your PC but your desktop/icons/random programs are already loaded by the time you type it in? Intel have a feature in their wireless drivers called single sign-on that connects to your wireless network before you’ve logged in, to speed things up in that exact way; why can’t we do it with everything else?

Turns out that a) we can, and b) it’s easy to do, because I’m not the first person to think of doing it.

Full credit for the method involved, reproduced and summarised below, goes to these guys.

  1. Hit Windows + R, and run control userpasswords2. Click on your username, untick “Users must enter a username and  password to use this computer”, type in your password to confirm what you’re doing, and OK out of it – this will automatically log you in without prompting for a password.
  2. Create a file – they suggest, and I used, c:\windows\lock.cmd – that contains %windir%\System32\rundll32.exe user32.dll,LockWorkStation. Basically, you double-click it, and it locks your session until you re-enter your password.
  3. You could add lock.cmd to your startup folder, but a commenter suggested making it a login script instead, which is faster overall and better for security. Hit Windows + R and run gpedit.msc (you can’t do this on XP Home), go to User Configuration -> Windows Settings -> Scripts (Logon/Logoff), doubleclick Logon, and Add lock.cmd to the list.

After the above, your computer will automatically log you on, and then lock the PC. It’s not instantaneous, though; on my machine there was about a 30 second delay where my desktop icons and taskbar were loaded and usable before the lock script kicked in. I’ve come up with the following addition, making locking the PC the very first thing to happen after logging in.

As this article explains, Windows by default doesn’t wait for login scripts to run and finish before starting Explorer and loading the desktop for use; this is the theory behind XP Pro’s Fast Logon Optimisation, which ironically works against us in the pursuit of logging in faster.

Anyway, the basic idea is that we have to tell Windows to run our login script before doing anything else. Go back into gpedit.msc, browse to Computer Configuration -> Administrative Templates -> System -> Logon, and enable “Run logon scripts synchronously” (in XP), or “Always wait for the network at computer startup and logon” (in Vista/W7):

gpedit-logon

Mission complete. Next time you start your PC, it’ll boot, hit the welcome screen, log you in, and instantly lock the session without showing your desktop, while loading all your normal startup stuff safely behind it.

One Response to “Howto: Automatically log in and lock your session so things load faster”

  1. Jimmy says:

    i knew about the auto logon but this… timageek you’ve outdone yourself again! don’t forget the cucumber.

    clined wiggin

Leave a Reply

Line and paragraph breaks automatic.
XHTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>