Get-SCOMTask

Get-SCOMTask

Gets a list of tasks.

Syntax

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

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

Parameter Set: FromManagementPack
Get-SCOMTask [-ManagementPack] <ManagementPack[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromManagementPackClass
Get-SCOMTask [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [-Target <ManagementPackClass[]> ] [ <CommonParameters>]

Parameter Set: FromTaskDisplayName
Get-SCOMTask [-DisplayName] <String[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

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

Parameter Set: FromTaskName
Get-SCOMTask [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-Name <String[]> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Detailed Description

The Get-SCOMTask cmdlet gets a list of tasks. Use this cmdlet to get tasks that have a specific name or ID as well as tasks that are associated with specified user roles, class instances, management packs, or target classes.

Parameters

-ComputerName<String[]>

Specifies an array of names of computers. The cmdlet establishes temporary connections with management groups for these computers. You can use NetBIOS names, IP addresses, or fully qualified domain names (FQDNs). To specify the local computer, type 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

-DisplayName<String[]>

Specifies an array of display names for task objects. This parameter takes one or more strings, and the cmdlet looks for matches among the display names of the task objects that the cmdlet works with. Values for this parameter vary depending on which localized management packs are imported into the management group and the locale of the user that runs Windows PowerShell.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

true

-Id<Guid[]>

Specifies an array of task IDs. The cmdlet gets the tasks that have these IDs. To obtain a task, use the Get-SCOMTask cmdlet. The ID is the ID property of a task object.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Instance<EnterpriseManagementObject[]>

Specifies an array of EnterpriseManagementObject objects that represent class instances. The cmdlet retrieves tasks for the class instances that the array stores. Specify a variable that represents the 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

-ManagementPack<ManagementPack[]>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Name<String[]>

Specifies an array of task names.

The cmdlet takes each string in the array and matches it with the Name properties of the task objects that this cmdlet works with.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

true

-SCSession<Connection[]>

Specifies an array of Connection objects. To get Connection objects, specify the Get-SCOMManagementGroupConnection cmdlet.

If this parameter does not appear, the cmdlet uses the active persistent connection to a management group. Use the SCSession parameter to specify a different persistent connection. You can create a temporary connection to a management group by using the ComputerName and Credential parameters. For more information, type "Get-Help about_OpsMgr_Connections".

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Target<ManagementPackClass[]>

Specifies an array of management pack class objects that represent target classes. Specify a variable that contains the target class objects, or use a cmdlet such as Get-SCOMClass that gets the target class objects.

Aliases

none

Required?

false

Position?

named

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 tasks by specifying a partial name

This command gets all tasks that have health in their names.

PS C:\> Get-SCOMTask -Name "*health*"

Example 2: Get a task by using a partial display name

This command gets all tasks that have display names that begin with Stop.

PS C:\> Get-SCOMTask -DisplayName "Stop*"

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

This command gets all tasks for the management packs that have System Center Core in their display names. The command uses the Get-SCOMManagementPack cmdlet to get management packs based on display names, and passes them to the to the Get-SCOMTask cmdlet. Because the command specifies SilentlyContinue for the ErrorAction parameter, if the cmdlet finds a management pack with no associated tasks, it continues to run and does not display error messages.

PS C:\> Get-SCOMManagementPack -DisplayName "System Center Core*" | Get-SCOMTask -ErrorAction SilentlyContinue

Example 4: Get tasks by using a partial class name

This command gets all tasks for classes that have health in their names.

PS C:\> Get-SCOMClass -Name "*health*" | Get-SCOMTask

Example 5: Get tasks by specifying a partial class instance name

This command gets all tasks for class instances that have .Contoso.com in their names.

PS C:\> Get-SCOMClassInstance -Name "*.Contoso.com" | Get-SCOMTask

Example 6: Get a task by specifying an ID

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

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

Get-SCOMClass

Get-SCOMClassInstance

Get-SCOMManagementPack

Get-SCOMManagementGroupConnection

Get-SCOMTaskResult

Start-SCOMTask