I have a simple PS script that is running a single query against our dev env, when I run it manually, works great so I know it's all setup within the script perfectly.
When I have the Alert Trigger Aciton run the script, it will not successfully run the "Connect-SWIS" command. It returns a null in the $swis variable every time it runs.
Whether or not I run it as a specific user in the action or the default user (network service) also has no impact.
try {
$swis = Connect-Swis -Hostname $hostname -UserName "domain\user" -Password "password" -ErrorAction stop
"Connected" | Out-File -Append $Logfile
} catch {
"Failed!" | Out-File -Append $Logfile
}