Looking for a code snippet to do the following
Shutdown Server #1
reboot server #2
Wait for server to come back fully
Power Up server #1
I know it is simplistic, trying to get my feet wet with PowerCLI
Thanks
Do you have VMware Tools installed on those VMs?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes they are installed.
Try something like this
$srv1 = 'SRV1'
$srv2 = 'SRV2'
$vm1 = Get-VM -Name $srv1 | Shutdown-VMGuest -Confirm:$false
while($vm1.PowerState -ne 'PoweredOff'){
sleep 5
$vm1 = Get-VM -Name $srv1
}
$vm2 = Get-VM -Name $srv2 | Restart-VMGuest -Confirm:$false
Wait-Tools -VM $vm2
Start-VM -VM $vm1 -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
This is great. Thanks so much, I should be able to build on this.
Ian