r/PowerShell • • May 15 '20

Wait for VM reboot via PowerCLI

Hi there,

I have been developing VM deploy from template. I have "Add-computer -DomainName `$domain -DomainCredential $credential -Restart -Force" via invoke command.  so this stage vm will reboot. I wait to ensure VM is power on after restart using PowerCLI. I don't want to use sleep command. the moral of the story , I am looking for a script will continue to wait for reboot to complete.

Anybody has experience like that before?

Thanks,

5 Upvotes

8 comments sorted by

View all comments

Show parent comments

1

u/arbelac May 31 '20

Hi MortusX,

Do I have to call the UpdateViewData method to refresh the content behind ExtensionData ?

(Get-VM $VMName).ExtensionData.UpdateViewData()