Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What I want to do is, to set one of 2 users as default user and auto logon. After some research I found how to do it via gui:

  1. Windows Key + R
  2. Enter control userpasswords2
  3. Select user that you want to be default during auto logon
  4. Untick Users must ...

Something like that

enter image description here

But, there are about 70 computers in room that waits for user to select one of 2 user accounts: "admin" and "user1" before start. I want to do it not via GUI but with the help of simple .cmd or .bat script. is that possible? How to set user1 as default account and disable logon user selection screen with bat file? Please help.

BTW, the windows I use is XP

share|improve this question

1 Answer 1

up vote 6 down vote accepted

You can set these values in registry:

  1. Enable Auto Logon: reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1

  2. Set username for logon: reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d youruser

  3. Set domain if your pc is in domain: reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /t REG_SZ /d yourdomain

  4. Set users password: reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d yourpassword

  5. Set how many times it shoud logon automatically (0 for infinite): reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoLogonCount /t REG_DWORD /d 0

Copy these in setlogon.bat file and you have your script.

share|improve this answer
    
WHat if you have no pass? –  user978733 Dec 4 '12 at 7:33
1  
Never tried that, but I suppose that empty DefaultPassword, should work. –  week Dec 4 '12 at 19:04
    
This doesn't work for me. Also, putting your password in cleartext in the registry seems really really wrong. When using control userpasswords2, the password is hashed somewhere, and the "DefaultPassword" registry key isn't added. Does this really work for anyone? –  DanielSmedegaardBuus Nov 3 '13 at 14:49
    
Yep, It's working, at least on Windows (2k, XP, 7), I've used this over the years for automatic deployment. And yes it's not wise for ordinary use. Well, hashed somewhere means registry:) and no it's not hashed, it's encrypted and stored in LSA. But it's still in registry under `HKLM\security`. Try this app to see all stored passwords there. It's not safe either. –  week Nov 4 '13 at 1:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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