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- 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#
Power Shell- Command Text See Designer Properties above.
- Input Represents the pipeline input for the powershell script. The input is represented as an IEnumerable(object).
- 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.
- 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.
- 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 PropertiesSee General Properties.
#
MiscSee Misc.
#
Out Error- 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
- Output Error See Out Error.
- String Errors All the PowerShell errors concatenated by new line in a string.
#
Output- 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
- String Result The result of the execution converted to string and separated by new Line.
#
ExampleIn 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.