$Computer= "192.9.200.110"
Connect-VIserver -server 192.9.200.110 -user root -Password Aa123456z
$vm = Get-VM -Name Server2012R2
if($vm.PowerState -eq 'poweredOn'){
shutdown-VMGuest -VM $vm -Confirm:$false
}
while($vm.PowerState -eq 'poweredOn'){
sleep 30
$vm = Get-VM -Name Server2012R2
}
$vm = Get-VM -Name Windows8
if($vm.PowerState -eq 'poweredOn'){
shutdown-VMGuest -VM $vm -Confirm:$false
}
while($vm.PowerState -eq 'poweredOn'){
sleep 30
$vm = Get-VM -Name Windows8
}
Set-VMHost 192.9.200.110 -State 'Maintenance'
Set-VMHostFirmware -VMHost 192.9.200.110 -Restore -SourcePath C:\Users\michelVA\Downloads\configBundle-192.9.200.110.tgz -HostUser root -HostPassword Aa123456z
start-process powershell.exe -argument '-nologo -noprofile -executionpolicy bypass -command Test-connection 192.9.200.110 -count 50'
Start-Sleep -Seconds 240
Start-Process -FilePath C:"\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher"\VpxClient.exe