---
sourceDocument: Australia ServiceNow AI Platform Capabilities
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/de-DE/servicenow-platform

 Release :

    - australia

ft:locale :

    - de-DE

ft:publication_title :

    - Australia ServiceNow AI Platform Capabilities

ft:clusterId :

    - platcap

bundleId :

    - platcap

workflow :

    - Platform


---

# Create a PowerShell activity

# Create a PowerShell activity {#ariaid-title1}

* Freigeben Version: Australia
* 
* Aktualisiert 12. März 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 4 Minuten Lesedauer

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

## Vorbereitungen

Role required: activity_creator or workflow_admin

## Warum und wann dieser Vorgang ausgeführt wird

ServiceNow supports PowerShell 3.0 to 5.1.

## Prozedur

1. Create a [custom
   activity](https://www.servicenow.com/docs/access?context=create-custom-activities&version=australia&pubname=australia-integrate-applications&ft:locale=en-US).  
   This action creates a custom activity using a template.
2. After setting up [general properties](https://servicenow-prod.fluidtopics.net/0Sm9zu2rRND~nSxb9VUhVw "The following General Property fields are common to all activity designer templates.") and [creating input
   variables](https://servicenow-prod.fluidtopics.net/9cajF_Pe381UXOE8RYlECw#CreateInputVariables "Create the variables to pass into the activity in the Inputs form of the activity designer."), configure the PowerShell Execution Command.

   | Option | Bezeichnung |
   | [Map the input variables](https://servicenow-prod.fluidtopics.net/9cajF_Pe381UXOE8RYlECw#t_MapAnInputVariable "After you create the input variables, map them to the fields in the Execution Command form.") | 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 {#t_CreateAPowershellActivity__ul_bsj_mzp_vz} |
   | 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. Hinweis: 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. Hinweis: 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. |
   |-|-|

   {#t_CreateAPowershellActivity__choicetable_asj_mzp_vz}  
   Hinweis:  
   You can map parameter values in a test payload to variables in the Outputs tab automatically. See [automap output
   variables](https://servicenow-prod.fluidtopics.net/zQra3zyXD57jq4LB0fHzRQ "You can map parameter values in a test payload to variables in the Outputs tab automatically.").

## Nächste Maßnahme

Finish creating your PowerShell activity by [creating output
variables](https://servicenow-prod.fluidtopics.net/4NlOweZ9wgBtc9OOpy0QJg#t_CreateAnOutputVariable "The Outputs form in the designer contains a variable builder for creating data structures of objects and arrays."), [creating a parsing rule](https://servicenow-prod.fluidtopics.net/jecuRsCuzIyfFDyPkB_Ehw#t_CreateAParsingRule "Populate output variables defined in a custom activity with payload data returned from an inputs test on an external host or endpoint."), or [Conditions](https://www.servicenow.com/docs/access?context=conditions&version=australia&pubname=australia-integrate-applications&ft:locale=en-US). Refer to the [create
custom activities](https://servicenow-prod.fluidtopics.net/0eg3YSA_OLwnlcnztlbEUw "You can create and update different types of custom activities in the Workflow Editor using a custom template.") topic to know your template options.

## PowerShell template execution parameters {#ariaid-title2}

You use execution parameters to create the input process script in the Pre Processing form of the activity designer.
For descriptions of the Powershell command fields, see the table in [Configure the PowerShell execution command](https://servicenow-prod.fluidtopics.net/9cajF_Pe381UXOE8RYlECw#t_MapPowershellVariablesToExecCmd "Use the input variables you created to configure the command that Orchestration executes on the Windows target machine.").  
Hinweis:  
You must use the `executionParam.` prefix with all variables in this table. {#r_PshellTmpltExctnPrm__table_b2b_jw5_cr__entry__4}

| Name | Variable | Type | Usage |
|-|-|-|-|
| Source | source | String | Target host on which to execute the command. |
| Script type | script_type | Enumeration | Type of script to run. The possible types are: * command: Custom PowerShell command. * file: Identifies the MID Server script file to run. {#r_PshellTmpltExctnPrm__ul_fz2_nw5_cr} |
| Command | command | String | Command sent to the MID Server for it to run on the target host. |
| MidScriptFile | midScriptFile | Reference | Reference sys_id of the MID Server script file to execute, when the script_type is file. |
| PowershellVariables | powershellVariables | Array of hashmap | Hashmap of JavaScript objects with name, value, and type for each object. The type of each object can be one of plain, encrypted, boolean, or null, corresponding to the PowerShell variable type selected in the inputs tab. For example, you might enter: var newParameter = {"name":"parameterName","value":"parameterValue", "type": "plain" }; executionParam.powershellVariables.push(newParameter); |
| Credential tag | credential_tag | String | Specific credential tag this activity must use to run PowerShell commands on the host. |
| MidCapabilities | midCapabilities | String (comma separated) | List of required MID Server capabilities. |
| ValueCapabilities | valueCapabilities | Array of hashmap | Capability values used to select the MID Server. For more information, see [MID Server capabilities](https://servicenow-prod.fluidtopics.net/Ixqp8gLvT6tnD2ksANEvaQ "MID Server capabilities define the specific functions of a MID Server within an IP address range."). If there are additional capabilities that are assigned by value, use this example to customize the MID Server selection: var valueCapability = {'NEW_MID_CAPABIILTY':'NEW_MID_CAPABILITY_VALUE'}; executionParam.valueCapabilities.push(valueCapability); |
[Tabelle : 1. Powershell execution parameters]

{#r_PshellTmpltExctnPrm__table_b2b_jw5_cr}

## Powershell post-processing parameters and payload parsing {#ariaid-title3}

Use these parameters to create a post-processing script, payload parsing, and
tagging.
{#powershell-payload-parsing-tags__table_grr_t2v_cr__entry__4}

| Name | Variable | Type | Usage |
|-|-|-|-|
| Tags | tags | Hashmap of tag values to return from the PowerShell command. | Contains the tags used to extract output using the PowerShell commands. The tag output is delimited by double percentage signs, as in %%tagname%% ... %%. Set up the command using the format in this example: Write-Host %%tagname1%% output1 line 1 output1 line 2 ... Write-Host%% Write-Host %%tagname2%% output2 line 1 output2 line 2 ... Write-Host%% The tags returned are JavaScript hashmap objects in which each key is prefixed with tag appended with the tagname. {"__text__": "", "tagtagname1":"output1 line1\noutput1 line2\n", "tagtagname2":"output2 line1\noutput2 line2\n"} |
| Hresult | hresult | String | Contains any hresult returned from the PowerShell command. If no hresult is returned, this parameter is null. |
| Output | output | String | Contains the raw output from the PowerShell command. |
| EccSysID | eccSysID | String | Contains the reference ID associated with the ECC Queue input message returned by the activity. |
| ErrorMessages | errorMessages | String | Contains any error messages retrieved from the PowerShell command. This value is null if there are no error messages. |
[Tabelle : 2. Powershell post-processing parameters]

{#powershell-payload-parsing-tags__table_grr_t2v_cr}

