Set Windows Server 2012 Hyper-V Virtual Machines

In Windows Server 2012 Hyper-V, each virtual machine has three options for the automatic start and three options for the automatic stop actions. Use these Windows PowerShell commands to set them up.

John Savill

January 3, 2013

1 Min Read
Set Windows Server 2012 Hyper-V Virtual Machines

Q: How can I quickly set my virtual machines (VMs) that aren't using my standard automatic start and stop actions in my Windows 2012 Hyper-V environment?

A: Each VM has three options for the automatic start and three options for the automatic stop actions.

Start - Nothing

Never start the VM when the Hyper-V host starts

Start - Start

Always start the VM when the Hyper-V host starts

Start - StartIfRunning

Start the VM if it was running when the Hyper-V host was shutdown (this is the default)

Stop - Save

Save the state of the VM if running when the Hyper-V host is shutdown (this is the default)

Stop - Shutdown

Perform a clean shutdown of the VM if running when the Hyper-V host is shutdown

Stop - TurnOff

Perform a hard turn off of the VM if running when the Hyper-V host is shutdown

The state of VMs can be viewed with the following PowerShell command in Windows Server 2012:

Get-VM | ft name,automaticstartaction,automaticstopaction

The AutomaticStopAction can only be changed while the VM is stopped but if you wanted all VMs to perform a clean shutdown and to never automatically start you could use the command below for those not currently using the default.

Get-VM | Where-Object {$_.AutomaticStartAction -eq "StartIfRunning"} |Set-VM -AutomaticStartAction Nothing -AutomaticStopAction ShutDown

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like