Invoke Powershell

The ‘InvokePowerShell’ activity will call a Microsoft Windows PowerShell file or command that is specified in the Command Text expression.

note

When pasting the command directly in CommandText, we must tick Is Script property for the command to work.

Most of the properties on this activity can be set using variable expressions which must be enclosed inside double quotation marks “”.

Designer Properties#

Invoke Powershell designer
  1. Command Text The command text, or the Microsoft Windows PowerShell file to be executed. When using the command directly in the Command Text, we must tick Is Script property for the command to work.

Properties#

Invoke Powershell properties

Power Shell#

  1. Command Text See Designer Properties above.
  2. Input Represents the pipeline input for the powershell script. The input is represented as an IEnumerable(object).
  3. Is Script Sets the method of how the script is executed. Checked when using a PowerShell command script directly in Command Text; Unchecked when using a PowerShell file in Command Text.
  4. Parameters The parameters to be sent to the power shell script. Represented as a Dictionary(string, object), where key is the name of the parameter and value is its value.
  5. Power Shell variables The predefined powershell variables.Represented as a Dictionary(string, object), where is key is the name of the variable and value is its value.

General Properties#

See General Properties.

Misc#

See Misc.

Out Error#

  1. Errors The output errors reported by the PowerShell script as a Collection of ErrorRecord. For more information about ErrorRecord please https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.errorrecord?view=powershellsdk-7.0.0
  2. Output Error See Out Error.
  3. String Errors All the PowerShell errors concatenated by new line in a string.

Output#

  1. Output The result of the execution as a Collection of PSObject. For more information on PSObject, please check https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.psobject?view=powershellsdk-7.0.0
  2. String Result The result of the execution converted to string and separated by new Line.

Example#

Copy Files using powerShell

In this example, the activity will copy all the ‘rpack’ files from ‘SampleProjects to ‘ProjectsOutput’ using the Microsoft Powershell command "copy-item SampleProjects\*.rpack ProjectsOutput -force -recurse -verbose"

SampleProjects and ProjectsOutput are relative directories to Rinkt Studio.