Configuring Autologon on a Windows 7 Device is actually pretty easy. You specify a few Registry Keys and most of the time you are good and your Device is performing an Autologon from this time on.
Generally you have to ask yourself if an Autologon, especially in Company Networks, is a good idea because of potential Security Risks. However, there are always some exceptions like Production Terminals, Kiosk Computers, etc.
For configuring Autologon, I always used the following PowerShell Script, which is setting the required Registry Keys:
# Credentials $username = 'john.doe' $password = 'Pa$$w0rd' $domain = 'CONTOSO' # Activate Autologon via Registry New-ItemProperty -Path 'HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'AutoAdminLogon' -PropertyType 'String' -Value '1' -Force New-ItemProperty -Path 'HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'DefaultUserName' -PropertyType 'String' -Value $username -Force New-ItemProperty -Path 'HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'DefaultPassword' -PropertyType 'String' -Value $password -Force New-ItemProperty -Path 'HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'DefaultDomainName' -PropertyType 'String' -Value $domain -Force
Today, I had a pretty weird issue. After running this Script on a Windows 7 Computer and performing a Restart afterwards to test the Configuration, Windows didn’t perform an Autologon and stopped normally on the User Login Screen. Looking again in the Registry, I noticed that the previously set Registry Value AutoAdminLogon was reset to 0 and DefaultPassword was deleted.
Now to make this even more interesting, after running the same script again a second time and perform a Reboot afterwards, Autologon worked without any issues.
After a few hours of troubleshooting and monitoring the Registry on different steps, I figured out that after you apply the Script for the first time and perform a reboot, the existing Registry Value AutoLoginCount was deleted as well with DefaultPassword.
The Resolution I came up with, was to modify my above script to set the needed Registry Values for Autologon and afterwards delete the AutoLoginCount Value
# Credentials $username = 'john.doe' $password = 'Pa$$w0rd' $domain = 'CONTOSO' # Activate Autologon via Registry New-ItemProperty -Path 'HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'AutoAdminLogon' -PropertyType 'String' -Value '1' -Force New-ItemProperty -Path 'HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'DefaultUserName' -PropertyType 'String' -Value $username -Force New-ItemProperty -Path 'HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'DefaultPassword' -PropertyType 'String' -Value $password -Force New-ItemProperty -Path 'HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'DefaultDomainName' -PropertyType 'String' -Value $domain -Force # Remove AutoLogonCount Value Remove-ItemProperty -Path 'HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'AutoLogonCount' -Force
With this modification, Autologon was working again on the first try. 🙂
I hope the above information will help you if you experience the same Problem.
Many thanks for posting this!
Thanks – this was bugging the absolutel hell out of me
Thanks – this was bugging the absolute hell out of me!
Thank you !! SO MUCH !! been 2hours on this now .. wondering if GPOs was killing my reg keys ..
You’re very welcome 🙂
Thanks a million Simon, i was scratching my head on this for days… You saved my day
Ja coloquei Sequência de tarefas run command line no sccm mas nao funciona. e agora? Por favor eu preciso de sua ajuda
Hey Simon..
you really also made my day!!!! I was searching for this (including debug phase, because at first i did not recognize that it was related to that) for one week!!
Thank you sooo much!!!
Greetz from Austria
Thomas
Thanks Thomas!