User is attempting to run a Windows powershell script in response to a Spotlight alarm using the "Run program" option.
Below is an example of what user is trying to execute from the run-program line within the Diagnostic Server:
powershell -Command "C:\Scripts\forward_alarm.ps1 -a testarg | out-file C:\Scripts\jc.txt -Append"
The contents of the "forward_alarm.ps1 script are below:
write-output $args
The jc.txt file never gets created.
解决办法
Before a user-defined PowerShell script can execute on a server, the script has to be either digitally-signed or the execution-policy for PowerShell on the server has to be lowered to allow the execution of scripts.
Once user changed the execution-policy for PowerShell to "RemoteSigned", the Spotlight Diagnostic Server is able to execute user PowerShell script(s).