Use a custom PowerShell script as an Object
Automation Manager incorporates over 600 bundled objects. It also includes the option to incorporate your own PowerShell script through the Run PowerShell Script object.
To apply a custom PowerShell script when building a policy:
- Go to the objects pane
- Under Extensions choose Run PowerShell Script
- Drag and drop the Run PowerShell Script object onto the target area of the policy
- Choose the Scripts tab of the Run PowerShell Script object
- Click Edit
- Paste you PowerShell script contents
- OK to apply the script
- Configure the Input and Output Parameters (where required)
Input and Output Parameters
For the script engine to recognize the PowerShell script's Input and Output parameters in the Run PowerShell Script Object, the parameters must be preceded by $
Example | |
---|---|
Parameter Name |
Parameter Name as entered in the Run PowerShell Script Object |
InputParameter |
$InputParameter |
OutputParameter |
$OutputParameter |
Exit codes returned by the PowerShell script are only consumed within the Run PowerShell Script module and not passed back to the Dashboard.
To generate a Dashboard failure where the PowerShell script fails, add an If or If/Else Control Flow condition and include the Fail Policy module.
For example, Run PowerShell Script (Extensions) > If (Control Flow) > Then > Fail Policy (Control Flow)
What do you want to do?
- Launch the Automation Manager
- View the Automation Manager Overview and learn about policy components (objects, control flow, parameters etc.)
- Construct a Policy (script) using Automation Manager
- Read more information on policy debugging
- Discover how to edit a policy (.amp) script