This question already has an answer here:

I like to go get coffee while the computer starts. However we have a policy that says the screen must be locked when away.

How can I make sure that the screen locks immediately after logging in?

marked as duplicate by Ƭᴇcʜιᴇ007 windows-7 Jan 21 '15 at 21:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



RUNDLL32 USER32.DLL,LockWorkStation


You can create a Shortcut to the c:\Windows\System32\rundll32.exe and add the parameter. If you put this shortcut in the Autostart folder, your computer will be locked after login.

Screenshot is german, but the shortcut target should look like this, (verified with Windows 8 but should work with Windows 2000+)


  • +1, I used to use this to lock my XP workstation from RDP sessions. – deed02392 Jul 2 '13 at 9:41
  • 2
    -1. Raymond Chen/The Old New Thing: What can go wrong when you mismatch the calling convention?: "[The function signature required for functions called by rundll32.exe is documented in this Knowledge Base article.] That hasn't stopped people from using rundll32 to call random functions that weren't designed to be called by rundll32, like [user32 LockWorkStation] or [user32 ExitWindowsEx]." Besides, rundll32 is deprecated since Vista. – a CVn Jul 2 '13 at 9:53
  • @Michael, didn't know about that, thanks. Raymond has a good point and here are some more reasons why not to use rundll blogs.msdn.com/b/oldnewthing/archive/2013/01/04/10382242.aspx and as a programmer it makes sense to say Don't use it, call the function yourself but as a user it should be more like Use it at your own risk, if it works for you – Jürgen Steinblock Jul 2 '13 at 10:30
  • @SchlaWiener I might agree, if it wasn't for the fact that as pointed out by Raymond Chen this kind of trick can work intermittently. Working as a programmer, intermittently occuring bugs are the ones I loathe the most trying to track down. And I don't want to think about what calling (random) Win32 API functions with random parameters could potentially do to application state. If I feel like it later today or this weekend, maybe I'll put together a small application that simply calls LockWorkStation as it was intended to be called, and put it somewhere for everyone's benefit. – a CVn Jul 2 '13 at 11:42
  • seems to work for me! – nute Jul 2 '13 at 12:54

If I am not mistaken, when you disable auto login the lock screen will be automatically activated.

  • 2
    But that will prevent the "preloading" of apps that are run at first login (mail client, browser) – Jürgen Steinblock Jul 2 '13 at 7:23
  • Right. I have another idea in mind, I will think about it – matan129 Jul 2 '13 at 7:24
  • Well I thought about launching the executable in system32 which locks the computer, and apparently it's rundll32 - and SchlaWiener gave you great answer. – matan129 Jul 2 '13 at 7:44

I copy the following from http://www.sevenforums.com/general-discussion/293057-how-do-i-completely-remove-user-lock-screen-when-i-boot-up.html:


To lock, choose Require a password (recommended). I see that this does NOT state 'Lock' explicitly, but once you choose this, your home screen will become Locked, even without a password.

Not the answer you're looking for? Browse other questions tagged or ask your own question.