Get-SCOMTaskResult

Gets the results for tasks that have run.

Syntax

Get-SCOMTaskResult
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
Get-SCOMTaskResult
   [-BatchID] <Guid[]>
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
Get-SCOMTaskResult
   [-Id] <Guid[]>
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
Get-SCOMTaskResult
   [-Instance] <EnterpriseManagementObject[]>
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
Get-SCOMTaskResult
   [-Task] <ManagementPackTask[]>
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]

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.

Examples

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

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

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.

Example 2: Get task results by specifying class instances

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

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.

Example 3: Get task results by specifying a task ID

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

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

Example 4: Get task results by specifying a batch ID

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

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

Parameters

-BatchID

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

Type:Guid[]
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ComputerName

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.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Credential

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.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Id

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

Type:Guid[]
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Instance

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.

Type:EnterpriseManagementObject[]
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-SCSession

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.

Type:Connection[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Task

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.

Type:ManagementPackTask[]
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False