PowerShell
This article provides information on the following topics:
Note: For more information about Timing and Error settings, read the Action Builder article.
What is the PowerShell Action?
The PowerShell Action allows you to access PowerShell from within Nintex RPA.
Creating a PowerShell Action
Select Advanced Actions to expand the Action list. Select thePowerShell Action from the Actions list to display the Action Builder.
Specify where you would like to run the PowerShell Script from. The Script can either be Embedded within your botflow or it may reference an External file.
Optionally add Notes to the Action to document any special instructions or functionality. When the Run Switchis set to Run, the action will be executed after clicking OK.
Note: The run switch is set to Run by default. To create or modify this action without executing it, click the slider to change the option to Don't Run. For more information, see Action Builder.
Click the OK button to save the Action.
Returning Values from PowerShell
The PowerShell script can call the RPAEngine.SetVar function to set the value of a variable in the botflow. This example sets the value of variable FirstName to "John".
RPAEngine.SetVar -Variable "FirstName" -Value "John" |
The RPAEngine.SetVar function can be used more than once to set multiple variable values. This example sets the value of both the FirstName and LastName variables in a botflow:
RPAEngine.SetVar -Variable "FirstName" -Value "John" RPAEngine.SetVar -Variable "LastName" -Value "Doe" |
Note: The RPAEngine.SetVar function is a custom PowerShell function automatically added to your PowerShell code allowing you to call it from within your PowerShell script. All variable values are set after the PowerShell code has finished running.