## PowerCLI Reference

# Get-Task

## Synopsis

This cmdlet retrieves the tasks on a vCenter Server system.

Syntax

Get-Task [[-Status] <TaskState>] [-Server <VIConnection[]>] [<CommonParameters>]
Get-Task -Id <String[]> [-Server <VIConnection[]>] [<CommonParameters>]

Related Commands

Online version
Stop-Task
Wait-Task

Detailed Description

This cmdlet retrieves the tasks on a vCenter Server system. The cmdlet retrieves information about the current or recent tasks. Use the Status parameter to filter tasks by their current status. To specify a server different from the default one, use the Server parameter.

Parameters

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
Status | TaskState | Specifies the status of the tasks you want to retrieve. The valid values are Error, Queued, Running, and Success. Passing values to this parameter through a pipeline is deprecated and will be disabled in a future release. | false | true (ByValue)
Id | String[] | Specifies the IDs of the tasks that you want to retrieve. Note: When a list of values is specified for the Id parameter, the returned objects would have an ID that matches exactly one of the string values in that list. | true | false
Server | VIConnection[] | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. | false | false

Return Type

Zero or more Task objects

Notes

Examples

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

    $serv = Connect-VIServer -Server 10.23.112.235

    $task = Get-Task -Server $serv -Status Error

    $task

Retrieves information on all tasks on the server with IP address 10.23.112.235, whose state is "Error".

Copyright © VMware, Inc. All rights reserved.