Wait-Task
This cmdlet waits for the specified tasks to complete or fail before allowing the next command input. The task progress is observed in real time on the console screen.
Syntax
-Task
<Task[]>
[CommonParameters]
[CommonParameters]
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required |
|
Task[] | named |
|
Specifies the tasks you want to wait to complete. |
Output
System.Object
Examples
Example 1
Import-Module VMware.VimAutomation.Core
$task = Remove-VM -VM "VM1" -Confirm -RunAsync
Wait-Task -Task $task
Waits for the virtual machine with name "VM1" to be removed before allowing the next command input. This example uses commands from the VMware.VimAutomation.Core module.