How to Make Hyper-V Virtual Machines Launch Automatically at Startup

Running virtual machines with Hyper-V is simple, but setting a specific VM to launch automatically at startup isn't such an obvious process. Having a VM launch on its own and/or in sequence with other hosts can be a critical aspect in both corporate and personal computing environments.

By default, when the host computer powers down, Hyper-V will keep a record of which VMs were active at the time of shutdown and then attempt to restart them automatically at launch when the host machine is powered back on.

However, you can set specific VMs to launch automatically every time, never launch automatically, or launch after a specified startup delay. In this guide we'll cover the automatic startup and stop options that can be used to streamline the launching and shutting down of Hyper-V VMs:

How to Automatically Start a Virtual Machine in Hyper-V

Unlike other programs, setting up a virtual machine to launch by itself is not achieved by creating a shortcut in the Windows Startup folder. Instead, the automatic launch settings must be configured within Hyper-V Manager or each individual VM. To do this you'll have to adjust the Automatic Start Action options within the domain controller settings. Here's how to do that:

1. Open Hyper-V Manager.

2. In the list of virtual machines, right-click on the name of the virtual machine you want to launch automatically. Click the Settings... option within the context menu:

3 full How to Make HyperV Virtual Machines Launch Automatically at Startup

3. Scroll down in the left navigation pane and click on the "Automatic Start Action" module:

1 full How to Make HyperV Virtual Machines Launch Automatically at Startup
Now you should see three main options, as shown in the screenshot below. Here's a brief explanation of what each one does:

  • "Nothing" – Sets the VM to never launch automatically, regardless of the state of the host machine during shutdown.

  • "Automatically start if it was running when the service was stopped" – This is the default setting, which instruct Hyper-V Manager to automatically launch any VM that was running at the time of shutdown. Every newly created VM is given this setting. When this is enabled, the VM will be launched by the Hyper-V Virtual Machine Management Service (VMMS.exe). It's intended to automatically launch VMs after system reboots, but it only happens if the VM was running when the host machine powered down. It also may not work if the host OS crashes.

  • "Always start this virtual machine automatically" - This is the setting we're interested in. It will instruct Hyper-Manager to launch the VM automatically every time the host machine boots. Enabling this option will set the VM to launch at startup, but Hyper-V Manager must be set to launch automatically at startup for this setting to work, otherwise the VM won't run until you manually launch Hyper-V Manager.

Screenshot of Automatic Start Action settings in Hyper-V:

2 full How to Make HyperV Virtual Machines Launch Automatically at Startup

Understanding the Startup Delay Option

The Startup Delay feature is particularly useful in virtual environments that are setup using multiple VMs and/or host machines. The two most common reasons for using the startup delay are:

1. Launching System Components in Proper Sequence - Having VMs and controllers launch in sequence requires proper timing, and the startup delay option is where you'll adjust this setting. Although the aforementioned “always start this virtual machine” feature will take care of the launch, if you don't vary the startup delays between VMs/controllers they'll all launch at the same time. Of course, if a Root domain controller isn't started before a Child domain controller then the latter won't be able to function.

2. Conserving System Resources During Startup – Another reason a less advanced user might utilize the startup delay is to keep Hyper-V Manager and VMs from consuming RAM and processing power during the initial startup phase. Doing this will allow other startup programs to launch faster because they'll have access to more system resources. For example, you might want to make sure your anti-malware and media programs are running before launching the VM. Postponing the VM launch until everything else is loaded usually only requires a 30-60 second delay time, but you can figure out an exact value by timing how long it takes for all of your other programs to launch at startup.

How to Automatically Stop a Virtual Machine in Hyper-V Manager

A similar option module called “Automatic Stop Action” can also be found in the left navigational pane. This setting lets you decide what action the virtual machine manager will take when it detects that the computer is shutting down. There are three main options:

  • "Save the virtual machine state" - Hyper-V Virtual Machine Management Service (VMMS.exe) will automatically save the current VM state on the designated local disk when Hyper-V Server shuts down. This is typically the default setting.

  • "Turn off the virtual machine" - Instructs VMMS.exe to simply power down the VM before the computer shuts down.

  • "Shut down the guest operating system" - Instructs the guest operating system to shut down when the VM is powered down. In other words, the VM's OS will shutdown automatically when the VM powers down. In order for this to work the “Hyper-V Shutdown” service must be running in the virtual machine.

It should be noted that Automatic Stop Action will not work if the Hyper-V Server crashes due to an unexpected system failure, such as loss of power or a crash in the host OS.

Conclusion

Ultimately, the option to automatically start or stop VMs in Hyper-V is a luxury to some users and a necessity to others. If you're managing a multi-tiered virtual environment with Hyper-V Manager, being able to launch VMs in proper sequence is an essential skill. It's best to experiment with all of the options covered in this guide so that you'll have hands-on experience with them and will be able to practically apply them in future scenarios.

Post a Comment

0 Comments