Restart-VMGuest -VM $VM | Wait-Tools
Even this is not working sometime. The VM is off and the status comes back with guestToolsRunning
Restart-VMGuest -VM $VM -Confirm:$false | out-null
Write-Host “Waiting....reboot $VM”
sleep -Seconds 1
Set-Variable -name ToolsStatus -Value (Get-VM $VM).extensiondata.Guest.ToolsRunningStatus
until ($toolsStatus -eq "guestToolsRunning")
Since you seem to address this to me, I already replied in the other thread, that this is not working all the time.
What is the problem with using the GuestOperationsReady property as I mentioned here and in the other thread?
Thank you, I really appreciate your patience.
But I really do not understand why the simple loop does not work, the trick with the toolsStatus would be nice
I will check your other solution..
Because Restart-VMGuest triggers the restart inside the guest OS and then the cmdlet comes back.
When the cmdlet comes back, the VMware Tools are most probably still running.
And the loop will be run once and the script continues.
I think I mentioned that you first have to wait for the poweredOff state.