ironmansoftware / powershell-universal

Issue tracker for PowerShell Universal
https://powershelluniversal.com
36 stars 4 forks source link

5.0.11 - Trigger After Script finishes with Warning #3914

Open ErvM opened 1 week ago

ErvM commented 1 week ago

Version

5.0.10

Severity

Medium

Environment

msi

Steps to Reproduce

Not sure if this is a bug or feature request. Create a trigger that runs once a script finishes. The script completes successful but it's in a warning state because the module that I am using is just noisy.

Expected behavior

Trigger kicks off when script finishes.

Actual behavior

The trigger doesn't run, I think because the script/job finished in a warning state.

Additional Environment data

5.0.11

Screenshots/Animations

No response

adamdriscoll commented 1 week ago

This should work. I tried myself and didn't see this behavior.

image

New-PSUTrigger -Name "Trigger" -EventType "JobCompleted" -TriggerScript "TriggerScript.ps1"

I just have a Write-Warning call in a script to cause the trigger to take place.

emoeckel commented 1 week ago

I have some more details @adamdriscoll

Here is my trigger -

image

Here is the script either being kicked off by a schedule (manually triggered) or manually running the script. Nothing runs after it.

image

adamdriscoll commented 1 week ago

I was able to reproduce in our test suite but only when I had another trigger that had a script that was missing. Can you check your log for any errors referring to triggers?

emoeckel commented 1 week ago

@adamdriscoll I don't see any error in Platform > Logging for triggers. The only errors that I see are my own caused errors with APIs and credentials etc... I only have the one trigger currently that I have been trying to make work. However, maybe this could be related? I am having issues calling any environment that is not integrated, even including Agent. I am going to make an issue with those details.

emoeckel commented 1 week ago

Disregard the above statement about other environments not working, it's due to Run-As, probably bad creds etc... But the trigger issue is still an issue.