0

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?

Edit: An Admin seems to have closed my question, citing: This question already has answers here: Change user for automatic login (2 answers) How do I change automatic logon via Script or Command Line? (3 answers) But that is not true, and my question is explicitly different from those questions for a very specific situation that is not covered in those questions relating to Hyper-V (as stated in both the question and the question title). Those linked articles do not answer this scenario at all.

$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.

3

1 Answer 1

0

While VMware uses integration services, software that you install inside a VMware VM so that you can interact with the VM from the Host, Hyper-V uses a different approach in the "Enhanced mode" that seems to be a wrapper from the Hyper-V environment itself. The pro to this is that you don't need to install software into the VM, but the downside is that it creates a strange hybrid access interface to the VM and you are no longer on the VM's actual console. It turns out then that all of the autologon PowerShell or .reg scripts work, and the VM logs in, but from Enhanced Mode you do not see that it has logged in as you are not on the VM's proper console. To see the autologon happen, you have to go to the View menu and uncheck "Enhanced Mode" and then reboot. More about this here.

However, this is still not a complete answer, since I still cannot get the system to autologon while in Enhanced Mode, since having to work in Basic Mode is a much less useful experience.

Not the answer you're looking for? Browse other questions tagged .