The Activity Library includes specialized activities that incorporate Windows PowerShell scripts, VBScript scripts, or command-line scripts into workflows. Use a script activity to import the content of the script and to define the parameters that the script requires to run. The Authoring Tool creates a task in the management pack to manage the script and store the script content and parameters.
Service Manager does not verify the script parameters; therefore, you have to ensure that the script logic handles validation. Also, when you create an incident with an extended property and do not provide a value for the extended property the value of the parameter is not parsed, and it is passed as $Data/Property.
Script activities run as a separate process from the workflows; however, they also run under the security context of the Service Manager Workflow account.
Use the following procedure to add a script to a workflow.
To add a script to a workflow
In the Management Pack Explorer, expand Workflows, right-click the workflow that you want, and then click Edit. This opens the workflow in the authoring pane.
In the Activities Toolbox pane, locate the activity group Script Activities and its subgroup Generic Script Activities. Drag the script activity that you want to use to a position between the workflow start and workflow end icons, or between two existing activities.
Set the script activity properties:
- In the Details pane, click any of the properties in the
Activity Inputs category, and then click the ellipses
(…) button that appears next to the property.
- In the Configure a Script Activity dialog box, click
Import Script. In the Import dialog box, select the
script file that you want to use, and then click Open.
Caution After you import a script for a script activity, if you click Import Script again, any new script that you import completely replaces the previous script.
- Click Script Properties. To create a parameter for the
script, click New, and in the Name column, type a
Note For VBScript script and command script activity, there is no Name column.
- To set a value for the parameter, in the Value column,
type a constant value. If appropriate for the parameter, type
switch characters such as ‘/t’ which is typical for command
- To bind the parameter to another property so that the parameter
obtains its value from that property, click the corresponding
ellipses (…) button. In the Bind ‘Parameter’ to Activity
Property dialog box, select the property that you want to
- If you are working with a script that requires Windows
PowerShell snap-ins in order to run, in the Windows PowerShell
snap-ins box, type the names of the snap-ins, separated by
- Click OK to close the Configure a Script Activity
- In the Details pane, click any of the properties in the Activity Inputs category, and then click the ellipses (…) button that appears next to the property.