Skip to content

Instantly share code, notes, and snippets.

@lelegard
Last active April 21, 2022 14:30
Show Gist options
  • Save lelegard/d468732bde19c06c3de1ef7a383ccc85 to your computer and use it in GitHub Desktop.
Save lelegard/d468732bde19c06c3de1ef7a383ccc85 to your computer and use it in GitHub Desktop.
Enabling auto-login on Windows 10 using PowerShell

Enabling auto-login on Windows 10 using PowerShell

On Windows 10, the auto-login feature is notoriously dangerous for general use. However, it can be useful in some specific and restricted environments, for instance a single-user virtual machine running on a desktop system.

Auto-login is normally enabled using the Windows Settings or the Control Panel. This option is available only when Windows is activated. On single-user virtual machines, Windows is not always activated and it is not possible to access this option.

To directly enable auto-login, even on an unactivated Windows system, open a PowerShell window as administrator and run the following commands:

$RegistryPath = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'
Set-ItemProperty $RegistryPath 'AutoAdminLogon' -Value "1" -Type String 
Set-ItemProperty $RegistryPath 'DefaultUsername' -Value "(username)" -type String 
Set-ItemProperty $RegistryPath 'DefaultPassword' -Value "(password)" -type String

Of course, be sure to replace (username) and (password) with the actual user name and password.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment