Export (0) Print
Expand All
Expand Minimize

Start-SCOMTask

Updated: January 26, 2014

Applies To: System Center 2012 R2 Operations Manager

Start-SCOMTask

Starts a task for a specified object.

Syntax

Parameter Set: Empty
Start-SCOMTask [-Instance] <EnterpriseManagementObject[]> [-Task] <ManagementPackTask> [[-TaskCredentials] <PSCredential> ] [[-Override] <Hashtable> ] [ <CommonParameters>]




Detailed Description

The Start-SCOMTask cmdlet starts a task for a specified object. This cmdlet takes a task object and a class instance object as input. The cmdlet accepts only one task, but it can accept multiple class instances and overrides.

Parameters

-Instance<EnterpriseManagementObject[]>

Specifies an array of EnterpriseManagementObject objects that represent class instance objects for which to start a task. Specify a variable that stores the class instances or use a cmdlet such as the Get-SCOMClassInstance cmdlet 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

-Override<Hashtable>

Specifies a hash table that defines new values for one or more task parameters, if those parameters allow overrides. For more information about hash tables, type "Get-Help about_Hash_Tables".

To determine which parameters for a task allow overrides, use the GetOverrideableParameters method for the task object.


Aliases

none

Required?

false

Position?

4

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Task<ManagementPackTask>

Specifies a task object to start. Specify a variable that represents a task, or use a cmdlet such as the Get-SCOMTask cmdlet that gets a task. This parameter accepts only one task object.


Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-TaskCredentials<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?

3

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.

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: Start a task by using a display name

This example starts a task by using a display name.

The first command gets all class instances in the Contoso.com domain and stores them in the $Instances variable.

The second command gets the task that has the display name Get Monitor State and starts the task for each class instance that is stored in the $Instances variable.


PS C:\> $Instances = Get-SCOMClassInstance -Name "*.Contoso.com"
PS C:\> Get-SCOMTask -DisplayName "Get Monitor State" | Start-SCOMTask -Instance $Instances

Example 2: Start a task by using a display name and a timeout specification

This example shows how to start a task by using a display name and a hash table that specifies a timeout value.

The first command creates a hash table that has a value for the Timeout key and stores it in the $Overrides variable.

The second command gets all class instances that have the name Contoso Service and stores them in the $Instances variable.

The third command gets the task that has the display name Start NT Service and starts the task for each class instance that is stored in the $Instances variable.

The fourth command starts the task for each class instance that is stored in the $Instances variable. The command specifies a Timeout key value of 60.


PS C:\> $Overrides = @{Timeout=60}
PS C:\> $Instances = Get-SCOMClassInstance -DisplayName "Contoso Service"
PS C:\> $Task = Get-SCOMTask -DisplayName "Start NT Service"
PS C:\> Start-SCOMTask -Task $Task -Instance $Instances -Override $Overrides

Example 3: Start a task by using credentials

This example starts a task by using credentials.

The first command prompts the user for a user name and password, creates a credential object from the input, and stores the credential object in the $Credential variable.

The second command gets a class instance named Server01.Contoso.com and stores it in the $Instance variable.

The third command gets a task that has the display name Reset State and starts the task for the class instance that is stored in $Instance. The command runs the task under the credentials that are stored in $Credential.


PS C:\> $Credential = Get-Credential
PS C:\> $Instance = Get-SCOMClassInstance -Name "Server01.Contoso.com"
PS C:\> Get-SCOMTask -DisplayName "Reset State" | Start-SCOMTask -Instance $Instance -TaskCredentials $Credential

Related topics

 
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft