Simple way to manage Automatic Start for multiple VMs at once

A simple command to see all Automatic Start actions is to run:
[sourcecode language=”powershell”] get-vm -ComputerName HypervHost | select name,auto*
[/sourcecode] (If you are running this on the Host you can ignore the “-ComputerName”)

To disable automatic start for all VMs of the host run:
[sourcecode language=”powershell”] get-vm -ComputerName HypervHost | Set-VM -AutomaticStartAction Nothing

To enable automatic start for all VMs of the host run:
get-vm -ComputerName HypervHost | Set-VM -AutomaticStartAction Start

Now, to manage the automatic start delay you need a text file with names of the clients and the delay time.
Run Get-VM | select name>c:vm.txt to take a list of all VMs of the host
[/sourcecode] Open vm.txt and remove all blank lines. Now, simple add a second column with the delay time using comma (,). The txt file should look like this:

Name,Delay
CLIENTNAME01,0
CLIENTNAME02,180
CLIENTNAME03,360
CLIENTNAME04,540
CLIENTNAME05,720
CLIENTNAME06,900
CLIENTNAME07,1080
CLIENTNAME08,1260

Save the text file and run:
[sourcecode language=”powershell”] Import-Csv C:vm.txt | foreach {set-vm $_.Name -AutomaticStartAction start -AutomaticStartDelay $_.Delay}
[/sourcecode] and that’s all

Share