Page 1 of 1

Automate auto-login

Posted: Wed Sep 15, 2021 1:17 pm
by YiMeng
Ah ha, perfect, this would avoid traversing deep in the regedit to set autoadminlogon everytime.

JRVSInputs script for automating auto login on windows.


Code: Select all

REM Reg.exe documentation.
REM https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/reg-add

DISPMSG This automation will configure autologon. 
WAITINPUT Press "enter" to continue.

DISPMSG Specify full username with domain.
SETVARI username

DISPMSG Specify user Password.
SETVARI password

playInteS cmd.exe
delay .3

REPEATS 1 reg.exe delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /f|enter
REPEATS 1 reg.exe delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /f|enter
REPEATS 1 reg.exe delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /f|enter
REPEATS 1 reg.exe delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /f|enter

REPEATS 1 reg.exe add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /f /t REG_SZ /d 1|enter
REPEATS 1 reg.exe add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /f /t REG_SZ /d %username%|enter
REPEATS 1 reg.exe add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /f /t REG_SZ /d %password%|enter

DISPMSG Verify console or regedit for errors. 
WAITINPUT Press "enter" to exit.