What’s the appropriate method for breaking out of the main Try/Catch in Deploy-Application.ps1 to cause a failed installation/uninstallation?
If I ‘Throw’, it’ll display a nasty window to the user which is not what we want.
The ‘workaround’ for now is to simply Execute-Process that will fail.
If the end goal is to throw a failure, you use exit-script -exitcode 2 <-- or anything not a success. Put that wherever you want it to stop and you’re golden. If you’re looking to passthru exit codes from process, go see my last post here.
Shoot - I was too focused on breaking out of try/catch properly that I hadn’t considered simply exiting via the built-in function!
I don’t require anything in particular returned as the script is checking to validate a prerequisite, and if it’s not met, the script terminates. So sure, exitcode 1, 2 etc is fine.
Thanks again.