Wednesday 29 August 2018

Set user for auto logon on windows via batch script


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



Answer



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.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...