Executes a PowerShell script stored in the Model Manager under the specified name.

Before you use the ExecutePowerShellScript activity, you must first load the script that you want to execute into the Model Manager using the CloudUtil File-Import command.

Table 1. ExecutePowerShellScript Activity Input Parameters

Argument

Type

Description

ScriptName

String

Name in the Model Manager of the script to execute.

ScriptVersion

Object

(Optional) Version in the Model Manager of the script to execute. Default is 0.0.

MachineId

Guid

(Optional) If specified, the machine is loaded and all its properties are passed to the script.

Arguments

Dictionary<string,string>

Additional arguments to pass to the script. If MachineId is specified and there is a machine property with the same name as an argument (case-insensitive), the value of the machine property overrides the value of the argument.

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.

Table 2. ExecutePowerShellScript Activity Output Parameters

Argument

Type

Description

Output

Collection<PSObject>

Output of script if any. Throws exception on error.

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.