I have a situation where I run a powershell script to display and error message to the user. For example, I want to be able to send an email message indicating a failed deployment if the user goes directly to a "QA" build quality. The Deployment
The script merely does a write-host "Error: You cannot go directly to QA .."
message. The issue is that the email says success, because the script ran successfully, but I want the email to state "Failed". How can I force a failed situation. I have tried "exit 1" in the script, but the invoking code
does not pick it up. I have forced an error condition that displays a ERROR in the email, that is irrelevant to the situation. How can I cleanly display my output and force a failed email message