Network Management
Run a powershell script file (.ps1) via alert external program action
This article will explain how to run .ps1 PowerShell script files using Orion's "Run External Program" alert action.
First published date
Last published date
Product section
Resolution
- Add the "Run an external Program" action to the alert.
- In the file path, enter the path to powershell.exe followed by -File and the path to the .ps1 file.
Example:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File "C:\ScripTxt\test.ps1"
For the 32 bit version of PowerShell use:
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -File "C:\ScripTxt\test.ps1"
- Finish saving the action and alert as normal.
Note: The path must be above. Alerting cannot run the .ps1 file by itself. Powershell.exe must be specified.
Starting with SolarWinds Platform 2023.2, actions that execute an external script or program need to be approved by an administrator. Please see Approve alert actions executing a script for additional information and instructions on approving actions.