Automatic Logon in Windows 10 using PowerShell

This article describes how to configure Windows 10 to automate the logon process. By using this feature, you can automate the logon process to automatically log on with your account. This feature stores the credentials in the registry database.

Let’s see how it works:

  1. Click Start, and then click Run.
  2. Type Regedt32.exe, and then press Enter.
  3. Navigate to the following subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  4. Double-click the DefaultUserName entry, type your <username>, and then click OK.
  5. Double-click the DefaultPassword entry, type your <password>, and then click OK.

Note that you can also add a default domain name. Now, you must enable the auto logon feature:

  1. Click New, and type AutoAdminLogon, and then press Enter.
  2. Double-click AutoAdminLogon, and type 1 and then click OK.

Let’s check if it works by restarting your machine.

You can automate these steps using Windows PowerShell:

PS > $RegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
PS > $DefaultUsername = "your username"
PS > $DefaultPassword = "your password"
PS > Set-ItemProperty $RegPath "AutoAdminLogon" -Value "1" -type String 
PS > Set-ItemProperty $RegPath "DefaultUsername" -Value "$DefaultUsername" -type String 
PS > Set-ItemProperty $RegPath "DefaultPassword" -Value "$DefaultPassword" -type String

Editing the registry is risky! Remember to always backup the registry.

Thanks for reading! You can follow me on Twitter @PrigentNico

About Nicolas 282 Articles
I work as an IT Production Manager, based in Paris (France) with a primary focus on Microsoft technologies. I have 10 years experience in administering Windows Servers. . I am a Microsoft MVP for Cloud & Datacenter Management. I also received the PowerShell Hero 2016 award by PowerShell.0rg. And finally, I am "MCSE: Cloud Platform and Infrastructure", "MCSA: Windows Servers", "Administering & Deploying SCCM", and CheckPoint CCSA certified.