This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Is it possible to call a PowerShell script from the "Execute program" Alert Action in the Advanced Alert Manager?

I am trying to set up an alert action in SAM that triggers a PowerShell script.  I'm using the Advanced Alert Manager tool to set this up.  I have come up with this string to use for the action command, and in testing it appears to be executing as I want, with the correct parameter option, but it doesn't appear to be running at all.

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "C:\scripts\SomeScript.ps1 '${NodeName}'"

What the script should do is select some records from a database table and write them out to a log file.  I am using hard-coded SQL credentials in the script for now, and I can run this command directly and it will work.  However, when ran through the testing function of the Alert Manager, I see the correct command printed out, it doesn't seem to run.  I can't even get a simple echo "hello" >> somefile type command to work through this tool.

What am I missing?  Any ideas?

I already use this Orion server to run many PowerShell script monitors and I've already set the RemoteSigned execution policy for scripts.  The OS is Windows 2008 R2.

  • Here is sample output from the Test tool in the Alert Manager for a script.  It prints out a success message, but nothing runs.  I wish it would give me a return code, or something!

    12/19/2013 4:59:54 PM:    Initiating test for alert Testing Alert Trigger.

    12/19/2013 4:59:54 PM:    Retrieved 1 actions for alert Testing Alert Trigger.

    12/19/2013 4:59:54 PM:    Preparing action type ExecuteProgram to test alert Testing Alert Trigger.

    12/19/2013 4:59:54 PM:    Alert Testing Alert Trigger: - Success - C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "C:\scripts\derp.ps1 'server-host1'"

    12/19/2013 4:59:54 PM:    Action type ExecuteProgram for alert Testing Alert Trigger completed successfully.

    12/19/2013 4:59:54 PM:    Completed action type ExecuteProgram for alert Testing Alert Trigger.

    12/19/2013 4:59:54 PM:    Completed test for alert Testing Alert Trigger.

  • Got it.  The Alert Manager triggered the 32-bit version of powershell.exe.  I needed to set the RemoteSigned execution policy for scripts in the 32-bit environment and change my powershell.exe path.

    (in an elevated CMD prompt) C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe" set-executionpolicy remotesigned -force


    And then change the action to:

    C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -Command "C:\scripts\SomeScript.ps1 '${NodeName}'"


    I hope this helps somebody!


  • Thanks for posting this. I needed to do the same things to get my PS script to run from Alert Manager.

  • Hi I am also trying to do something similar, Can I ask you why at last u wrote ${NodeName}??

    Is your script dynamically fetching the name of node based on alert or affected server?

    I need your help dude!

  • The ${NodeName} is just a variable that passes along the name of the affected server as an argument to the PowerShell script.

  • Hi ,

    Can u share with me the powershell script , I am actually a newbie at it.!

  • Hi

    I am trying to execute a powershell script on one of my test servers through Orion alert action when an alert triggers from the server . I have pleased the script in one of my jump servers (Not Orion server/Local machine) and given the path of the script in the alert action.  But when an alert is triggering from test server the script is not executing and it is throwing error saying "File not found". I have given correct path only, but still the alert action is not able to find the script.

    1. Powershell version on the jump server and test servers is 2.0

    2. Script execution policy on Jump server is "Unrestricted" and on test server it is "RemoteSigned"

    I am just giving the path of the script, do i need to give the path of powershell.exe also in the alert action?

    Note : I am just fetching "Host name" and "Data and Time" of the test server.

    Am i missing anything ? Please help....

    Thanks in Advance emoticons_happy.png