If you use Windows-based Virtual Machine Profile (VMs) on Hyper-V, you may want to skip the login process every time you launch a lab. Learn how to configure Windows-based virtual machine (VM) to automatically log in to Windows.
If you are looking to configure an ESX virtual machine, read our Automatically Authenticate VMs in ESX documentation.
Best Practices for Disk Capture
Reduce Capture Time and Disk Size
Begin working with a VM that has no differencing disks captured already.
Don't leave the VM running for hours, and then capturing. This will increase the size of the disk and could affect VM performance.
Virtual Machine Optimization
Configure automatic log in on all virtual machines that need automatic log in, before capturing the first differencing disk. Capturing multiple disks could result in lower performance in the VM.
Configure Automatic Log In
The steps to configure automatic login on Hyper-V differ depending if the virtual machine(s) in the lab use Enhanced Session Mode (ESM). After the VM is configured to automatically login, a differencing disk will need to be captured to save the VM in it's current state, to allow subsequent lab launches to automatically log in to the configured VM.
Enhanced Session Mode
Enables a connection similar to an RDP connection. Enhanced session mode leverages guest services to enable additional features such as: automatic VM logon, redirection of clipboard, audio, drives, devices, printers, and smart cards. Enhanced Session mode is not required for VM auto log in.
Configure a VM without Enhanced Session Mode Enabled
For labs that do not use ESM, Netplwiz must be configured to enable automatic login. The following configurations needs to be completed:
Configure Netplwiz
Save a Differencing Disk
Configure Netplwiz
Navigate to the lab profile that contains the VMs that you wish to enable automatic login on.
Launch the lab.
If the lab has multiple VMs, select the VM that should be automatically logged in.
Enter the login password and login to the VM.
In the Windows Start menu, search for Netplwiz, and then select Netplwiz.
Uncheck the box next to Users must enter a user name and password to use this computer.
In the dialog that appears, enter the VM user name and password and click OK.
Repeat steps 3-7 for any other VMs that should be automatically logged in.
Go to the Save a Differencing Disk section to save the VM state, so that subsequent lab launches will launch in this state.
Configure a VM with Enhanced Session Mode Enabled
For labs that use ESM, Windows Registry and Group Policy must be configured to enable automatic login. The following configurations needs to be completed:
Disable Limit Local Accounts use of Blank Passwords
Disable Password Complexity Requirements
Set blank password via PowerShell
Edit Windows Registry
Save a Differencing Disk
Disable Limit Local Accounts use of Blank Passwords
Navigate to the lab profile that contains the VMs that you wish to enable automatic login on.
Launch the lab.
If the lab has multiple VMs, select the VM that should be automatically logged in.
Enter the login password and login to the VM.
In the Windows Start menu, search for Group Policy, then select Edit Group Policy.
Select Computer Configuration.
Select Windows Settings.
Select Security Settings.
Select Local Policies.
Select Security Options.
Double-click Accounts: Limit local account use of blank passwords to console logon only.
Select Disabled, and select OK.
Disable Password Complexity Requirements
In the Windows Start menu, search for Group Policy, then select Edit Group Policy.
Select Computer Configuration.
Select Windows Settings.
Select Security Settings.
Select Account Policies.
Select Password Policy.
Double-click Password must meet complexity requirements.
Select Disabled, and click OK.
Set a Blank Password via PowerShell
Now that the Group Policy is configured to allow a blank password, we need to set the password to be blank.
In the VM, open PowerShell as an administrator.
Enter the following command and press enter:
Set-LocalUser -name "Administrator" -Password ([securestring]::new())
If the username in your VM is not Administrator, replace Administrator
with the name of your username in the PowerShell command.
Edit Windows Registry
In the Windows start menu, search for regedit and select Registry Editor.
Navigate to the following path:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Edit the registry and ensure the values match the table below:
Name
Type
Data
AutoAdminLogon
Reg_SZ
1
DefaultPassword
Reg_SZ
cell
DefaultUserName
Reg_SZ
cell
ForceAutoLogon
Reg_DWORD
1
ForceUnlockLogon
Reg_DWORD
1
Save a Differencing Disk
Saving a differencing disk will capture the VM in it's current state, so that subsequent lab launches will launch in this state. The lab needs to be launched to capture a differencing disk.
From your running lab, select the hamburger menu in the upper-right corner of the lab window.
Select the Save option.
In the dialog, select the Commit my changes and update this lab profile option.
On the next screen, enter a note, then select the disk under the VM that was configured for automatic login, then select OK.
The differencing disk will be saved and a confirmation message will be shown when it has completed.
Related Topics
Configure an ESX Virtual Machine to Automatically Log In: configure an ESX based virtual machine to automatically log in.