How-To Technical

Windows 7: Auto Login to Domain Account and lock the desktop

For some of you that like to play with automation tools, or just want to auto login and have your programs start up, and well don’t necessarily want your desktop open to the world.

Tech Warning!  You need to play in the registry, so know what your doing or don’t do.


  1. Open Registry Editor (Start Orb –> type Regedit.exe)
  2. Browse to this location: HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionWinlogon
  3. Edit DefaultUserName key and type your domain user name (domainuserid)
  4. If doesn’t exist, Create DefaultDomainName (string or REG_SZ) key and edit it with your domain name
  5. If doesn’t exist, create DefaultPassword (string or REG_SZ) key and edit it with your password
  6. If doesn’t exist, create AutoAdminLogon (string or REG_SZ) key and edit with “1”.
  7. Close Registry Editor
  8. Open Notepad
  9. Type this:
    On Error Resume Next
    DIM objShell ‘sleep(“1”) Set objShell = CreateObject(“Wscript.Shell”)
    objShell.Run “%windir%System32rundll32.exe user32.dll,LockWorkStation”

    Sub Sleep(strTime)
    strTime2 = (strTime * 60) * 1000
    wscript.sleep strTime2
    End Sub

  10. Save it as “LockDesktop.vbs”
  11. Click Start –> All Programs. Right click on Startup and select Open.
  12. On Startup Folder, right click on empty space and select New –> Shortcut.
  13. Select your script (LockDesktop.vbs) on your saved location and create a shortcut.
  14. That’s it. Reboot your computer and watch your computer auto login with your account and locks the desktop right away.

If you change your password, remember to edit the registry (DefaultPassword)