VMware Cloud Community
khalidb
Contributor
Contributor

start many VM wait guest to boot

Hi Experts,

I'm a beginner in PowerCLI, I have made a script to start multiple VM's,

I have used the start-sleep command between each vm but want to know how I can start a vm and wait till the guest is started to start another?

Can somebody put me in the right direction?

Thanks a lot for your help

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership

When your VM has the VMware Tools installed, you could wait in a loop till the IP address is there

$vmName = 'MyVM'

$vm = Get-VM -Name $vmName

Start-VM -VM $vm -Confirm:$false

while (!$vm.Guest.IPAddress){

    sleep 5

    $vm = Get-VM -Name $vmName

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

khalidb
Contributor
Contributor

Hi LucD,

Thanks for your response I will test it

regards,

Reply
0 Kudos