PowerCLI Reference

Wait-Task

Synopsis

This cmdlet waits for the completion of the specified tasks.

Syntax

Wait-Task [-Task] <Task[]> [<CommonParameters>]

Related Commands

Online version
Get-Task
Stop-Task

Detailed Description

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.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
TaskTask[]Specifies the tasks you want to wait to complete.truetrue (ByValue)

Return Type

The output of the operation specified by the Task parameter

Notes

Examples

-------------- Example 1 --------------

$task = Remove-VM -VM VM -Confirm -RunAsync

Wait-Task -Task $task

Waits for the virtual machine to be removed before allowing the next command input.


Copyright © VMware, Inc. All rights reserved.