Skip to main content
2 of 3
added 686 characters in body
YorSubs
  • 959
  • 1
  • 15
  • 34

PowerShell, Windows 10 autologon inside a Hyper-V VM

I have a pristine Windows 10 VM inside a newly installed Hyper-V on a newly setup Windows 10 host, and have been trying to get the VM to autologon using PowerShell. I've spent quite a few hours on this, over 3 weeks, going through dozens of pages, and nothing works. I simply canno find anything that will cause the VM to autologon after reboots (after the below, I end up with the logon screen and have to manually enter the password). Please can someone show me how to get this VM to autologon?

$username = "User1"
$password = "password"

# Set registry keys for auto logon
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "AutoAdminLogon" -Value "1" -PropertyType String -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUserName" -Value $username -PropertyType String -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultPassword" -Value $password -PropertyType String -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "ForceAutoLogon" -Value "1" -PropertyType String -Force

Edit: I have finally found a solution for this; it has to do with "Enhanced Mode" on Hyper-V. I will create an answer below with the details and hopefully this is of use to others.

YorSubs
  • 959
  • 1
  • 15
  • 34