Windows PowerShell Script Activity
Updated: May 13, 2016
Applies To: System Center 2012 SP1 - Service Manager, System Center 2012 R2 Service Manager, System Center 2012 - Service Manager
This activity in System Center 2012 – Service Manager runs a Windows PowerShell script as part of a Windows Workflow Foundation (WF) workflow.
Design-Time Prerequisites
The Windows PowerShell Script activity depends upon the following prerequisites at design time:
- Windows PowerShell 2.0
Run-Time Prerequisites
Windows PowerShell 2.0
Properties
The Windows PowerShell Script activity uses the input properties that are described in the following table.
Display name | Internal name | Type | Required | Description |
---|---|---|---|---|
Continue On Error | ContinueOnError | Boolean | No. (The default setting is True.) | Determines whether the workflow should continue running if the activity fails. |
Has Error | HasError | N/A | Specifies whether the activity has an error set. (Read-only) | |
Management Group | ManagementGroupName | String | No | Specifies the management group to which the script server belongs. By default, this is set to localhost. (Read-only) |
Script Parameters | Parameters | Dictionary <string,string> | Yes | Specifies the name/value list of parameters to be passed into the script when it runs. You can set parameter values to any of the following management pack references: - $Target/…$ - $MPElement[…] - $Data/…$. $Data references are resolved only at run time in the parameters (not in the script itself). Using one of these references as the only value for a parameter sets that parameter to the XML string that represents the input data item (from GetItemXML). |
Script Body | ScriptBody | String | Yes | Specifies the text of the script itself. |
Snap-ins | SnapIns | String | No | Lists Windows PowerShell snap-ins to preload into the runspace. |
Script Server | Target | String | No | Specifies the Domain Name System (DNS) name of the server that runs the Service Manager console. Do not use localhost. |
Script Time Limit | TimeoutSeconds | Integer | No. (The default setting is 300 seconds.) | Specifies the maximum number of seconds to allow for the script to run. |
Errors and Exceptions
The Windows PowerShell Script activity uses the custom tracking service that is supplied by Service Manager to log errors and exceptions when the activity runs. The activity generates errors or exceptions as appropriate if any of the script properties cannot be resolved.
Remarks
For more information about Windows PowerShell, see Windows PowerShell.
See Also