I use Jenkins to launch another script that is locally installed on my computer. I launch the script like this:
Start-Process PowerShell "path\to\the\script" -Wait -RedirectStandardOutput "where\the\output\goes.txt"
When the script ends with an error it will close PowerShell. The error will show up in the Jenkins output, but the build will not fail. Is there a way to redirect the error to Jenkins so that the build will fail as well?