I've made that into a function, to exactly that:
function WaitforVM($VM)
{
while (((get-vm $VM ).ExtensionData.Guest.ToolsRunningStatus ) -ne "guestToolsRunning" )
{
Write-Host "Waiting for machine to come back....." -ForegroundColor Yellow
Sleep 5
}
}
Now all you have to do, is to start the VM after the CPU addition, wait, then restart and wait again:
Start-VM -VM $VM -Confirm:$False
WaitforVM -VM $VM
Restart-VMGuest -VM $VM -Confirm:$False
WaitforVM -VM $VM
Nice, right? Obviously this function can be used for other things, like being used in scripts when you create a new VM from template and boot it up to see if that VM is live already.
Thank you for your valuable content , Easy to understand and follow. As said, the migration to cloud is very essential for the protection of the database.
ReplyDeleteCloud Migration services
Aws Cloud Migration services
Azure Cloud Migration services
Vmware Cloud Migration services
Database Migration services
Cloud Migration Tool
Best Cloud Migration Tool
Lia Infraservices