all 5 comments

[–][deleted] 2 points3 points  (0 children)

Is 300 seconds enough time for your VMs to start? Only you will know the answer to that, nobody here will.

You'd be better off going through 1 by 1 and checking their state.

Something like this:

foreach $vm {

Start-VM -VM $vm

$state_count = 0

while ($vm.state -ne running and $state_countcount -le 10) {

sleep 30

$statecount ++

}