Configuring Hyper-V VMs for Automatic Login
    • 05 Sep 2024
    • 4 Minutes to read

    Configuring Hyper-V VMs for Automatic Login


    Article summary

    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:

    1. Configure Netplwiz

    2. Save a Differencing Disk

    Configure Netplwiz

    1. Navigate to the lab profile that contains the VMs that you wish to enable automatic login on.

    2. Launch the lab.

    3. If the lab has multiple VMs, select the VM that should be automatically logged in.

    4. Enter the login password and login to the VM.

    5. In the Windows Start menu, search for Netplwiz, and then select Netplwiz.

    6. Uncheck the box next to Users must enter a user name and password to use this computer.

    Netplwiz uncheck box to require a user name and password

    1. In the dialog that appears, enter the VM user name and password and click OK.

    2. Repeat steps 3-7 for any other VMs that should be automatically logged in.

    3. 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:

    1. Disable Limit Local Accounts use of Blank Passwords

    2. Disable Password Complexity Requirements

    3. Set blank password via PowerShell

    4. Edit Windows Registry

    5. Save a Differencing Disk

    Disable Limit Local Accounts use of Blank Passwords

    1. Navigate to the lab profile that contains the VMs that you wish to enable automatic login on.

    2. Launch the lab.

    3. If the lab has multiple VMs, select the VM that should be automatically logged in.

    4. Enter the login password and login to the VM.

    5. In the Windows Start menu, search for Group Policy, then select Edit Group Policy.

    6. Select Computer Configuration.

    7. Select Windows Settings.

    8. Select Security Settings.

    9. Select Local Policies.

    10. Select Security Options.

    11. Double-click Accounts: Limit local account use of blank passwords to console logon only.

    12. Select Disabled, and select OK.

    Disable Password Complexity Requirements

    1. In the Windows Start menu, search for Group Policy, then select Edit Group Policy.

    2. Select Computer Configuration.

    3. Select Windows Settings.

    4. Select Security Settings.

    5. Select Account Policies.

    6. Select Password Policy.

    7. Double-click Password must meet complexity requirements.

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

    1. In the VM, open PowerShell as an administrator.

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

    1. In the Windows start menu, search for regedit and select Registry Editor.

    2. Navigate to the following path:

      Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
      
    3. 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

      Registry editor enable auto log in

    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.

    1. From your running lab, select the hamburger menu in the upper-right corner of the lab window.

    2. Select the Save option.

    3. In the dialog, select the Commit my changes and update this lab profile option.

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


    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.