Disable save state on virtual machines in Hyper-V

One of our architects asked me to configure settings on some VDI virtual machines in our Hyper-V environment, specifically the “Automatic Start Action” and “Automatic Stop Action” setting. After some searching in SCVMM, I was unable to find a configuration on the template where I could set this.
So, I turned to PowerShell.

1) We want to set the “Automatic Stop Action” to “Power Off” in order to disable the Save State when a Hyper-V server reboots. Since this is a VDI environment, it is desirable to shut down the VM’s since when a host reboots, the VM’s will be provisioned with the latest vDisk instead of picking up where they left and therefor still using the “old” vDisk.
2) We want to set the “Automatic Start Action” to “None” in order to not let the virtual machines come online when the host is rebooted, for example because the Desktop Group could be set in maintenance mode within the time the Hyper-V server rebooted.

I actually found several scripts on the internet, but all of them a bit complicated and rather large… since I’m a guy of few lines, this is what I came up with:

$VMMServer = Get-VMMServer -Computername "scvmm"
Get-VM | Set-VM -StartAction NeverAutoTurnOnVM -StopAction TurnOffVM


  1. Lavy says:

    How do we find what is the value set for Automatic Start and Stop Action using Powershell?

  2. Jeff Wouters says:

    Hi Lavy,
    This will provide you with all the properties and values: Get-VM | Select -Property *
    Simply replace the * with the name of the property you desire.
    Hint: AutomaticStartAction & AutomaticStopAction 😉

Leave a Reply

Your email address will not be published. Required fields are marked *