vSphere PowerCLI Reference

Get-Task

Synopsis

Retrieves the tasks on a vSphere server.

Syntax

Get-Task [[-Status] <TaskState>] [-Server <VIServer[]>] [<CommonParameters>]

Related Commands

Online version
Stop-Task
Wait-Task

Detailed Description

Retrieves the tasks on a vSphere server. 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

NameTypeDescriptionRequired?Pipeline InputDefault Value
StatusTaskStateSpecify 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.falsetrue (ByValue)
ServerVIServer[]Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse

Return Type

Task

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 © 1998 - 2011 VMware, Inc. All rights reserved.