I've been working on this for days and tried every option I could think of. The problem is the alert will not execute a powershell script and I'm not getting any error. The script works from command line using "runas" as the same user that manages the alerts. WOuld really appreciate second set of eyes on this... is what I'm doing possible? There are threads regarding running powershell from monitor/apms here I'm using the alert to run it.
a little twist here but leave off the -noexit and instead of using WCRIPT or CSCRIPT use the Alert ACTION called "Execute an External Program"
and use this in your field PROGRAM TO EXECUTE
C:\windows\system32\windowspowershell\v1.0\powershell.exe -noprofile doit.ps1
BUT alter your .PS1 to this
$F = "out.txt"
get-date | out-file -append $F
My trigger is Ok.. because its triggering as expected.
Changing to Cscript made no difference.
I altered the above changes... still does update log file. WHen I do a "run-as" this works... its just when I run the Orion exe that it fails.
Removing the "no exit" made not difference.
Running as a external exe action still did not update the out.txt file.
From alert log:
Success - C:\windows\system32\windowspowershell\v1.0\powershell.exe -noprofile C:\Users\Networkmgr\Orion_Scripts\Powershell\doit.ps1
So I know "something" is running in Orion. Its just not doing what its suppose to do. I'm new to powershell so I'm sure its something I'm over looking.
My whole reason for using powershell was to handle passwords securely... vbscript calls powershell to unencrypt a password. This works fine when I don't use solarwinds. 😞
Can someone try running the above? That would definately point the problem into an environmental issue on my side.
yep. That is what I figured. Thanks much for checking. Time for me to do some reading on powershell env I guess....
One thought... my solarwinds alert engine is running as a non-local user... is this the same for you?
I know this is an old thread, but...
I came across this issue as well and my solution was to run powershell with:
powershell -ExecutionPolicy Bypass
Thanks for the tips. The reason I was using PS was to handle passwords. I ended up finding a tool built in-house (that one of our developers had created for doing the same thing).
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 150,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.