Virtualization Change Automatic Stop Action of Hyper-V Virtual Machine 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.

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 stop action is configured for each VM individually.

There are three options available to manage the automatic stop action of a Hyper-V virtual machine (VM):
  • Save the virtual machine state = Hyper-V will reserve disk space equal to the amount of memory used by the virtual machine when it is running so that memory can be written to disk when the physical computer shuts down or restarts. At the next startup, the virtual machine will automatically start and continue as it was.
  • Turn off the virtual machine = This option will pull the plug on the virtual machine. No state information is saved. The guest OS will act as if the virtual machine lost power if/when it is started up again. You can use this option if you don’t care about the state of a virtual machine and you need a quicker host shutdown.
  • Shut down the guest operating system = The guest OS of the virtual machine will be gracefully shut down when before the host will be shut down or restarted. No state is saved. The downside is that the guest OS and its services will take time to start up when the host restarts. You should consider delaying and ordering the start up of virtual machines if you select this option.
This tutorial will show you how to change the automatic stop of action of a Hyper-V virtual machine for your account in Windows 10 and Windows 11.


Contents

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




Option One

Change Automatic Stop 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_automatic_stop_action-1.png

3 Select (dot) Save the virtual machine state (default), Turn off the virtual machine, or Shut down the guest operating system for the automatic stop action you want for this virtual machine, and click/tap on OK.

Hyper-V_VM_automatic_stop_action-2.png

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




Option Two

Change Automatic Stop 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_automatic_stop_action_PowerShell-1.png

4 Do step 5 (save), step 6 (turn off), or step 7 (shut down) below for what you want.

5 Set Automatic Stop Action to "Save the virtual machine state"

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" -AutomaticStopAction Save

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" -AutomaticStopAction Save


Hyper-V_VM_automatic_stop_action_PowerShell-2.png

6 Set Automatic Stop Action to "Turn off the 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" -AutomaticStopAction TurnOff

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" -AutomaticStopAction TurnOff


Hyper-V_VM_automatic_stop_action_PowerShell-3.png

7 Set Automatic Stop Action to "Shut down the guest operating system"

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

Set-VM -Name "VMName" -AutomaticStopAction ShutDown

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" -AutomaticStopAction ShutDown


Hyper-V_VM_automatic_stop_action_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: 39
Last edited:
Top Bottom