VMware Cloud Community
MariusRoma
Expert
Expert
Jump to solution

Waiting for tasks to complete

I am writing a PowerCLI script that includes taks thate take some time to complete.

For example, my script includes a command to shutdown a VM, like:

Get-VM $vm | Shutdown-VMGuest

How can I ensure that the script waits till the VM is completely powered off?

Regards

marius

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The best way is to wait for the event that is fired when the VM is shut down.

See for example  1.  Re: Shutdown Guest -> move-vm -> power On


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

1 Reply
LucD
Leadership
Leadership
Jump to solution

The best way is to wait for the event that is fired when the VM is shut down.

See for example  1.  Re: Shutdown Guest -> move-vm -> power On


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference