Get-Task Command | Vmware PowerCLI Reference

Get-Task

This cmdlet retrieves the tasks on the specified VMware 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.

Syntax

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

Parameters

Required Parameter Name Type Position Features Description
required
Id String[] named
Specifies the IDs of the tasks that you want to retrieve. Note: When a list of values is specified for the Id parameter, objects with duplicate Id values are filtered out from the result list.
optional Server VIConnection[] named
  • wildcards
Specifies the VMware Servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on all connected servers.
Get-Task
[-Server < VIConnection[] > ]
[-Status < TaskState > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
optional Server VIConnection[] named
  • wildcards
Specifies the VMware Servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on all connected servers.
optional Status TaskState named
  • pipeline
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 deactivated in a future release.

Output

VMware.VimAutomation.Sdk.Types.V1.Task

Examples

Example 1

Import-Module VMware.VimAutomation.Core

$server = Connect-VIServer -Server 10.23.112.235

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

$task

Retrieves information on all tasks on the server with IP address 10.23.112.235, whose state is "Error". This example uses commands from the VMware.VimAutomation.Core module.

Related Commands

Task

This cmdlet retrieves the tasks on the specified VMware Server.

This cmdlet stops the specified tasks.

This cmdlet waits for the completion of the specified tasks.