How do I change automatic logon via Script or Command Line?

One can change the registry via a .reg file.

For example, create an autologin.reg file containing :

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"AutoAdminLogon"="1"
"DefaultUserName"="Administrator"
"DefaultPassword"="Pa$$w0rd"

Add DefaultDomainName if required, then just execute the file to get the values into the registry.

Or in a cmd script :

REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f
REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /t REG_SZ /d domainname /f
REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d Administrator /f
REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d Pa$$w0rd /f

(Warning: I didn't test the above.)


Can't you just use sysprep /oobe? It will finalize your install and show the welcome screen on reboot.

Read what sysprep is and how sysprep works for more information.