Get-SCOMTaskResult

Get-SCOMTaskResult

Gets the results for tasks that have run.

Syntax

Parameter Set: Empty
Get-SCOMTaskResult [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromInstance
Get-SCOMTaskResult [-Instance] <EnterpriseManagementObject[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromTask
Get-SCOMTaskResult [-Task] <ManagementPackTask[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromTaskResultBatchId
Get-SCOMTaskResult [-BatchID] <Guid[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromTaskResultId
Get-SCOMTaskResult [-Id] <Guid[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Detailed Description

The Get-SCOMTaskResult cmdlet gets the results for tasks that have run. Use this cmdlet to get results by task name or ID as well as for tasks that are associated with specified class instances or batches.

Parameters

-BatchID<Guid[]>

Specifies an array that contains the IDs of batches in which tasks run. The cmdlet gets task results for each batch.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-ComputerName<String[]>

Specifies an array that contains the name of the computer with which to establish a connection. Valid formats include a NetBIOS name, an IP address, or a fully qualified domain name (FQDN). To specify the local computer, specify the computer name, localhost, or a dot (.).

The computer must run the System Center Data Access service.

If you do not specify this parameter, the default is the computer for the current management group connection.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Credential<PSCredential>

Specifies the user account under which the management group connection runs. Specify a PSCredential object, such as one that the Get-Credential cmdlet returns, for this parameter. For more information about credential objects, type Get-Help Get-Credential.

This account must have access to the server that is specified in the ComputerName parameter if that parameter appears.

If you do not specify this parameter, the default is the account for the current user.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Id<Guid[]>

Specifies an array of task IDs. The cmdlet gets the results of tasks that have these IDs.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Instance<EnterpriseManagementObject[]>

Specifies an array of class instances for which to start a task. Specify a variable that stores class instances, or use a cmdlet such as Get-SCOMClassInstance that gets the class instances. This parameter also accepts group objects. To obtain a group object, use the Get-SCOMGroup cmdlet.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-SCSession<Connection[]>

Specifies an array of connections to management servers. To obtain management group connection objects, use the Get-SCOMManagementGroupConnection cmdlet. If this parameter does not appear, the default is the current management group connection.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Task<ManagementPackTask[]>

Specifies an array of management pack tasks. The cmdlet gets results for the task objects that the array contains. Specify a variable that contains task objects or use a cmdlet such as Get-SCOMTask cmdlet that gets tasks.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Get task results by specifying a partial display name and an error action

This command gets results for tasks that have SystemCenter in their names. The command uses the Get-SCOMTask cmdlet to get tasks based on name and passes them to the Get-SCOMTaskResult cmdlet by using the pipeline operator. Because the command specifies SilentlyContinue for the ErrorAction parameter, if the cmdlet finds a task with no matching results, the command continues to run and does not display error messages.

PS C:\> Get-SCOMTask -Name "*SystemCenter*" | Get-SCOMTaskResult -ErrorAction SilentlyContinue

Example 2: Get task results by specifying class instances

This command gets all class instances in the Contoso.com domain and then returns the task results for each class instance object. The command uses the Get-SCOMClassInstance cmdlet to get all the instances that have a display name that contains .Contoso.com and passes them to the Get-SCOMTaskResult cmdlet by using the pipeline operator. Because the command specifies SilentlyContinue for the ErrorAction parameter, if the cmdlet finds a class instance with no matching task results, the command continues to run and does not display error messages.

PS C:\> Get-SCOMClassInstance -DisplayName "*.Consoso.com" | Get-SCOMTaskResult -ErrorAction SilentlyContinue

Example 3: Get task results by specifying a task ID

This command gets the results of the task that has an ID of 7413b06b-a95b-4ae3-98f2-dac9ff76dabd.

PS C:\> Get-SCOMTaskResult -Id 7413b06b-a95b-4ae3-98f2-dac9ff76dabd

Example 4: Get task results by specifying a batch ID

This command gets the results of a task that runs in a batch that has an ID of 2ef74789-f9f5-46b0-af70-16d01d4f4577.

PS C:\> Get-SCOMTaskResult -BatchId 2ef74789-f9f5-46b0-af70-16d01d4f4577

Get-SCOMClassInstance

Get-SCOMGroup

Get-SCOMTask

Start-SCOMTask