Virtualization Automatically Run Hyper-V Virtual Machines at Startup in Windows 11


  • Staff
Hyper-V_virtual_machine_banner.png

Hyper-V enables running virtualized computer systems on top of a physical host. These virtualized systems can be used and managed just as if they were physical computer systems, however they exist in virtualized and isolated environment. Special software called a hypervisor manages access between the virtual systems and the physical hardware resources. Virtualization enables quick deployment of computer systems, a way to quickly restore systems to a previously known good state, and the ability to migrate systems between physical hosts.

Hyper-V is only available on 64-bit versions of Windows 10/11 Pro, Enterprise, and Education. Hyper-V is not available on the Home edition.

You can configure Hyper-V virtual machines to automatically run at startup when you boot or restart the computer (host OS).

The default automatic stop action is to save the state of virtual machines at the shut down or restart of the Hyper-V host. It means that if a VM was running before a shut down or restart, Hyper-V will start it automatically at the next startup. The automatic start action is configured for each VM individually.

There are three options available to manage the automatic start action of a Hyper-V virtual machine (VM):
  • Nothing = When a computer (host) boots, the virtual machine will not automatically run at startup (regardless of its state before the host shutdown or restart).
  • Automatically start if it was running when the service stopped = The virtual machine will automatically run at startup only if it has been running when the computer (host) shutdown or restart.
  • Always start this virtual machine automatically= The virtual machine will always run at startup when the computer (host) boots.
    • Automatic start delay = Specify a startup delay for the virtual machine in seconds. You can use the delay to manage the boot order of virtual machines, and reduce the load contention between virtual machines.
This tutorial will show you how to manage running Hyper-V virtual machines at startup for your account in Windows 10 and Windows 11.


Contents

  • Option One: Configure Automatic Start Action of Hyper-V Virtual Machines in Hyper-V Manager
  • Option Two: Configure Automatic Start Action of Hyper-V Virtual Machines in PowerShell


EXAMPLE: Hyper-V virtual machine automatically run at startup

When a Hyper-V virtual machine is set to automatically run at startup, it will turn on the virtual machine and run in the background at startup when you sign in. You will still need to "Connect" the virtual machine to open it in Hyper-V.


Hyper-V_virtual_machine_automatically_run_at_startup.png





Option One

Configure Automatic Start Action of Hyper-V Virtual Machines in Hyper-V Manager


1 Open Hyper-V Manager (virtmgmt.msc).

2 Perform the following actions: (see screenshot below)
  1. Select the Hyper-V host (ex: "BRINKW11") you want in the left pane.
  2. Select the virtual machine (ex: "W10 UEFI") you want in the middle pane.
  3. Click/tap on Settings in the right "Actions" pane.
Hyper-V_VM_run_at_startup_Hyper-V_Manager-1.png

3 Do step 4 (Nothing), step 5 (Automatically start if it was running when the service stopped), or step 6 (Always start this virtual machine automatically) below for what you want.


4 Set Automatic Start Action to "Nothing" for Hyper-V Virtual Machine

A) Click/tap on Automatic Start Action in left pane of the VM settings. (see screenshot below)​

B) Select (dot) Nothing.​

C) Click/tap on OK, and go to step 7.​

Hyper-V_VM_run_at_startup_Hyper-V_Manager-2.png

5 Set Automatic Start Action to "Automatically start if it was running when the service stopped" for Hyper-V Virtual Machine

This is the default setting.


A) Click/tap on Automatic Start Action in left pane of the VM settings. (see screenshot below)​

B) Select (dot) Automatically start if it was running when the service stopped.​

C) Click/tap on OK, and go to step 7.​

Hyper-V_VM_run_at_startup_Hyper-V_Manager-3.png

6 Set Automatic Start Action to "Always start this virtual machine automatically" and specify "Automatic start delay" for Hyper-V Virtual Machine

A) Click/tap on Automatic Start Action in left pane of the VM settings. (see screenshot below)​

B) Select (dot) Always start this virtual machine automatically.​

C) Type how many seconds you want for a Startup delay.​

The default is 0 seconds startup delay. You can use the startup delay to manage the boot order of virtual machines, and reduce the load contention between virtual machines.


D) Click/tap on OK, and go to step 7.​

Hyper-V_VM_run_at_startup_Hyper-V_Manager-4.png

7 When finished, you can close Hyper-V Manager if you like.




Option Two

Configure Automatic Start Action of Hyper-V Virtual Machines in PowerShell


You must be signed in as an administrator to use this option.


1 Open Windows Terminal (Admin), and select Windows PowerShell.

2 Copy and paste the command below into Windows Terminal (Admin), and press Enter to see the VMName, AutomaticStartAction, AutomaticStartDelay, and AutomaticStopAction for all available Hyper-V virtual machines. (see screenshot below step 3)

Get-VM –VMname * | Select-Object VMname,AutomaticStartAction,AutomaticStartDelay,AutomaticStopAction

3 Make note of the VMName (ex: "W10 UEFI") you want to configure the automatic start action for. (see screenshot below)

Hyper-V_VM_run_at_startup_PowerShell-1.png

4 Do step 5 (Nothing), step 6 (Automatically start if it was running when the service stopped), or step 7 (Always start this virtual machine automatically) below for what you want.


 5. Set Automatic Start Action to "Nothing" for Hyper-V Virtual Machine

A) Type the command below into Windows Terminal (Admin), press Enter, and go to step 8. (see screenshot below)​

Set-VM -Name "VMName" -AutomaticStartAction Nothing

Substitute VMName in the command above with the virtual machine name (ex: "W10 UEFI") you want from step 3.

For example: Set-VM -Name "W10 UEFI" -AutomaticStartAction Nothing


Hyper-V_VM_run_at_startup_PowerShell-2.png


 6. Set Automatic Start Action to "Automatically start if it was running when the service stopped" for Hyper-V Virtual Machine

This is the default setting.


A) Type the command below into Windows Terminal (Admin), press Enter, and go to step 8. (see screenshot below)​

Set-VM -Name "VMName" -AutomaticStartAction StartIfRunning

Substitute VMName in the command above with the virtual machine name (ex: "W10 UEFI") you want from step 3.

For example: Set-VM -Name "W10 UEFI" -AutomaticStartAction StartIfRunning


Hyper-V_VM_run_at_startup_PowerShell-3.png


 7. Set Automatic Start Action to "Always start this virtual machine automatically" and specify "Automatic start delay" for Hyper-V Virtual Machine

A) Type the command below into Windows Terminal (Admin), press Enter, and go to step 8. (see screenshot below)​

Set-VM -Name "VMName" -AutomaticStartAction Start -AutomaticStartDelay seconds

Substitute VMName in the command above with the virtual machine name (ex: "W10 UEFI") you want from step 3.

Substitute seconds in the command above with how many seconds startup delay (ex: "0") you want for this virtual machine.

For example: Set-VM -Name "W10 UEFI" -AutomaticStartAction Start -AutomaticStartDelay 0


Hyper-V_VM_run_at_startup_PowerShell-4.png

8 When finished, you can close Windows Terminal (Admin) if you like.


That's it,
Shawn Brink


 

Attachments

  • Hyper-V_virtual_machine.png
    Hyper-V_virtual_machine.png
    6.6 KB · Views: 20
Last edited:

z3r010

Administrator
Staff member
Local time
7:09 PM
Posts
1,885
Location
Worsley, Manchester, UK
OS
Windows 11 Workstation
I've found the Hyper-V VM autostart is a great way to use Home Assistant on my PC without having to mess with additional hardware.
 

My Computers

System One System Two

  • OS
    Windows 11 Workstation
    Computer type
    PC/Desktop
    Manufacturer/Model
    doofenshmirtz evil incorporated
    CPU
    Ryzen 9 5950X
    Motherboard
    Asus ROG Crosshair VIII Formula
    Memory
    Corsair Vengeance RGB PRO Black 64GB (4x16GB) 3600MHz AMD Ryzen Tuned DDR4
    Graphics Card(s)
    ASUS AMD Radeon RX 6900 XT 16GB ROG Strix LC OC
    Sound Card
    Sound BlasterX Katana
    Monitor(s) Displays
    3 x27" Dell U2714H & 1 x 34" Dell
    Hard Drives
    Samsung 980 Pro 1TB M.2 2280 PCI-e 4.0 x4 NVMe Solid State
    Drive
    PSU
    ASUS ROG THOR 850W 80 Plus Platinum
    Case
    ASUS ROG Strix Helios Midi-Tower ARGB Gaming Case
    Cooling
    ASUS ROG Strix LC Performance RGB AIO CPU Liquid Cooler - 360mm
    Keyboard
    Logi Ergo
    Mouse
    Logitech MX Master 3
    Internet Speed
    900/100 Mbps
    Browser
    Chrome
    Antivirus
    Windows Defender, Malwarebytes Pro
    Other Info
    HP M281 Printer
    Logitech Brio Stream webcam
    Yeti X mic
  • Operating System
    Windows 10
    Computer type
    Laptop
    Manufacturer/Model
    Surface Laptop
    CPU
    i7

Sammy888

Member
Local time
11:09 AM
Posts
126
OS
Windows 11
Is there any noticeable performance benefit to using Hyper-V when you're running Android emulators like Nox or Bluestacks?

BTW, I'm using Windows 11 Home (for now) but I may upgrade (again) to Pro in the future.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo
    Graphics Card(s)
    NVIDA 1650 Ti
    Monitor(s) Displays
    Lenovo C32q-20

cereberus

Well-known member
Power User
VIP
Local time
7:09 PM
Posts
1,674
OS
Windows 10 Pro + others in VHDs
Is there any noticeable performance benefit to using Hyper-V when you're running Android emulators like Nox or Bluestacks?

BTW, I'm using Windows 11 Home (for now) but I may upgrade (again) to Pro in the future.
Are you asking if you can run an emulator inside Hyper-V?

If so, you can, but it will be slow compared with running on host.

If you are asking if you can run hyper-v along side android emulators, again it is now supposed to be possible but it will be very slow. It is flakey anyway.

You are better off creating two boot entries to Windows 11 - one where hypervisor is on to run Hyper-V, and one where it is off to run android emulators.

This link shows how to do it (works for W11 as well) - does not matter article is talking about vmware - works for android emulators

 

My Computer

System One

  • OS
    Windows 10 Pro + others in VHDs
    Computer type
    Laptop
    Manufacturer/Model
    ASUS Vivobook 14
    CPU
    I7
    Motherboard
    Yep, Laptop has one.
    Memory
    16 GB
    Graphics Card(s)
    Integrated Intel Iris XE
    Sound Card
    Realtek built in
    Monitor(s) Displays
    N/A
    Screen Resolution
    1920x1080
    Hard Drives
    1 TB Optane NVME SSD, 1 TB NVME SSD
    PSU
    Yep, got one
    Case
    Yep, got one
    Cooling
    Stella Artois
    Keyboard
    Built in
    Mouse
    Bluetooth , wired
    Internet Speed
    72 Mb/s :-(
    Browser
    Edge mostly
    Antivirus
    Defender
    Other Info
    TPM 2.0

Sammy888

Member
Local time
11:09 AM
Posts
126
OS
Windows 11
Are you asking if you can run an emulator inside Hyper-V?

If so, you can, but it will be slow compared with running on host.

If you are asking if you can run hyper-v along side android emulators, again it is now supposed to be possible but it will be very slow. It is flakey anyway.

You are better off creating two boot entries to Windows 11 - one where hypervisor is on to run Hyper-V, and one where it is off to run android emulators.

This link shows how to do it (works for W11 as well) - does not matter article is talking about vmware - works for android emulators

Thanks for the reply. Actually what I meant was if there was anything to gain in enabling Hyper-V when using the Android emulators.

I sparingly use the Android emulators and I have seen messages popping up about Hyper-V from the emulators saying it should be enabled.

I'm not enough of a hard core user to go through the extra steps to create dual boot (entries) for W11.

Moving forward, if I understand your comment correctly, there's no point in enabling Hyper-V just to run the Android emulator applications like Nox or Bluestacks?
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo
    Graphics Card(s)
    NVIDA 1650 Ti
    Monitor(s) Displays
    Lenovo C32q-20
Top Bottom