Create a PowerShell activity

Create a custom PowerShell activity return data to a workflow from a host using Microsoft PowerShell.

Before you begin

Role required: activity_creator or workflow_admin

About this task

ServiceNow supports PowerShell 2.0 and above. PowerShell 3.0 does not support Windows 2003 Server.


  1. Create a custom activity.
    This action creates a custom activity using a template.
  2. After setting up general properties and creating input variables, configure the PowerShell Execution Command:
    Map the input variables Use the variables you created to configure the command that Orchestration executes on the MID Server.
    Target host Host name or IP address of the target server for this PowerShell activity.
    Script type Type of PowerShell script to run on the PowerShell host. Available options are:
    • Custom PowerShell command
    • MID Server script file
    MID Server script file The MID Server script file contains the PowerShell scripts. This field is available when the Script type selected is MID Server script file.
    Command PowerShell command the activity executes. This field is available when the Script type selected is Custom PowerShell command. You can create your commands by dragging and dropping input variables from the variable builder into this field.
    PowerShell variables Name-value pairs to pass to the host with PowerShell. You can create these variables manually, or drag input variables into the Value field. Encrypted input variables retain their encryption, regardless of the data type settings in this field. If you type in a value and select the Encrypted data type, your value appears in plain text. It is only encrypted when it passes to the ECC Queue.
    Use MID Service Account If checked, this activity authenticates on the target host using the credentials of the MID Server service account only, without trying any other credentials.
    Note: The Credential tag field is not available.
    Credential tag Credential tag this activity must use to run PowerShell commands on the host. If this field is left blank, the MID Server tries all the available credentials until it finds a valid one, ending with the MID Server service account. If a credential tag is defined, the MID Server tries the credentials with that tag specified only and does not try the MID Server service account.
    Note: This field is not available when the Use MID service account check box is selected.
    Required MID Server capabilities MID Server to use for querying PowerShell, by capabilities. By default, the system selects a PowerShell MID Server.
    Note: You can map parameter values in a test payload to variables in the Outputs tab automatically. See automap output variables.

What to do next

Finish creating your PowerShell activity by creating output variables, creating a parsing rule, or creating template conditions. Refer to the create custom activities topic to know your template options.