cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 9

Questions calling a PowerShell script via alert

I have seen a few posts regarding running a PS script through alerts actions but I still had questions.

Below is a screenshot of what I think should work.  

This is the call: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -Command "C:\scripts\ClusterServiceMonitor.ps1"

Does the script get called from the local server or does it call to the primary Solarwinds server to get the script?  Does the context of this command look good?

sjanssen_0-1606839514265.png

 

Here is a post I found: https://thwack.solarwinds.com/t5/SAM-Discussions/Is-it-possible-to-call-a-PowerShell-script-from-the...

Tags (1)
0 Kudos
1 Reply

All alert actions run on the primary application server only, here is an example of one of mine calling a powershell script and passing it a mess of arguments.

 

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -Command "& {& "D:\PS_SW_Alerts\omnibusPostEifMsg.ps1" -locale PROD -actionType triggerWarning -messageType Component -alertObjectID ${N=Alerting;M=AlertObjectID} -objectID ${N=SwisEntity;M=Application.ApplicationID} -alertName ${N=Alerting;M=AlertName} -node '${N=SwisEntity;M=Application.Node.Caption}' -sitOrigin '${N=SwisEntity;M=Application.ApplicationAlert.ApplicationName}' -sitDisplayItem '${N=SwisEntity;M=ComponentAlert.ComponentName}' -appName '${N=SwisEntity;M=Application.ApplicationAlert.ApplicationName}' -compAvailability ${N=SwisEntity;M=ComponentAlert.ComponentAvailability} }"

- Marc Netterfield, Github