Executes a PowerShell command.

Table 1. InvokePowerShell Activity Input Parameters

Argument

Type

Description

CommandText

String

Command to execute.

Arguments

IEnumerable<string>

(Optional) Arguments to the command.

Input

IEnumerable

(Optional) The input pipeline.

IsScript

bool

(Optional) Indicates whether CommandText is a script. Default is False.

This option is only available in the Properties pane and not in the Designer pane.

Parameters

Collection

(Optional) Collection of name-value pairs passed as parameters to the PowerShell script.

This option is only available in the Properties pane and not in the Designer pane.

PowerShellVariables

Collection

(Optional) Variables copied into the PowerShell runtime.

This option is only available in the Properties pane and not in the Designer pane.

PSModules

IEnumerable<string>

(Optional) Modules loaded into the PowerShell runtime during command execution.

This option is only available in the Properties pane and not in the Designer pane.

Runspace

Runspace

(Optional) Creating a PowerShell runspace and supplying it to this argument enables you to reuse the same runspace in multiple PowerShell invocations, which may result in performance improvements.

This option is only available in the Properties pane and not in the Designer pane.

Table 2. InvokePowerShell Activity Output Parameters

Argument

Type

Description

Output

Collection<PSObject>

Output of command if any. Throws exception on error.

Errors

Collection<ErrorRecord>

Errors resulting from execution if any.

If you receive the error message Type PSObject is not defined in the vRealize Automation Designer console when you are dealing with the output of ExecutePowerShellScript, perform the following steps:

  1. Click Imports in the lower left corner of the Designer pane.

  2. Select the System.Management.Automation assembly.