0

I have 2 accounts. How would I go about automatically logging in to one of the accounts when I start the computer up? So, it would not give the user the option to log into the other account right off the bat.

Would I use a batch file and use Group Policy to run it? If so, what command is used to log in from a batch file?

3

1 Answer 1

1

Try this:

set LOGON_KEY=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

rem check screen resolution here, if check succeeds:
rem set RESOLUTION_OK=y

if /i "%RESOLUTION_OK%"=="y" (
  reg add "%LOGON_KEY%" /v AutoAdminLogon /t REG_SZ /d 1
  reg add "%LOGON_KEY%" /v DefaultUserName /t REG_SZ /d USER
  reg add "%LOGON_KEY%" /v DefaultDomainName /t REG_SZ /d DOMAIN
  reg add "%LOGON_KEY%" /v DefaultPassword /t REG_SZ /d PASS
) else (
  reg add "%LOGON_KEY%" /v AutoAdminLogon /t REG_SZ /d 0
  reg delete "%LOGON_KEY%" /v DefaultUserName
  reg delete "%LOGON_KEY%" /v DefaultDomainName
  reg delete "%LOGON_KEY%" /v DefaultPassword
)

It should enable auto-logon for DOMAIN\USER with the password PASS. To avoid storing credentials in a script, you could manually create and populate the values DefaultUserName, DefaultDomainName and DefaultPassword, and only toggle the AutoAdminLogon value.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .