0

I have a Domain Controller that needs to be able to autologon as Administrator. I tried all the online solutions, but after every reboot I get Username or Password incorrect, while I know it is correct.

I made the autologon part into a function. (It's part of a schoolproject).

I tried to store the password as just plain text, that didn't change anything.

I don't know if this info is useful, but I use an AZERTY keyboard (Belgian Point). But the password I use is from the letters that are not affected by QWERTY or AZERTY. The password has a number, but Numlock is off at every reboot. Could that be the problem? (Would seem weird though).

Does anyone know what it is I am doing wrong?

Function Logon-Password 
{
$Global:RegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" 

$Global:domain = $env:USERDOMAIN
$Global:username = "$domain\$env:USERNAME" 
$Global:password = Read-Host -AsSecureString "Type password"

Set-ItemProperty $RegPath "DefaultUserName" -Value "$username" -type String 
Set-ItemProperty $RegPath "DefaultPassword" -Value "$password" -type String 
Set-ItemProperty $RegPath "AutoAdminLogon" -Value "1" -type String 
Set-ItemProperty $RegPath "AutoLogonCount" -Value "1" -type DWord 
Set-ItemProperty $RegPath "ForceAutoLogon" -Value "1" -type DWord
} 
Alex P.
  • 30,437
  • 17
  • 118
  • 169
Laetitia
  • 3
  • 3
  • Oh, it's because you can't read in the password `-AsSecureString`. If you are implementing it by setting the registry, like this, you have to have the password in plaintext. See the other posts in: [Auto login Windows Server 2012](https://superuser.com/a/832936/200684) for other ways of storing the password encrypted – HAL9256 May 27 '19 at 19:22
  • For some reason the Function doesn't work. So I tried https://gallery.technet.microsoft.com/scriptcenter/Set-AutoLogon-and-execute-19ec3879 I dot-source the script. And you're right, the password has to be in plaintext. Thank you! – Laetitia May 28 '19 at 12:19

1 Answers1

0

nothing wrong, but because Autologon will attempt to run before AD services are ready to handle authentication after reboot :)