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
Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.