tag:help.appveyor.com,2012-11-13:/discussions/questions/20126-powershell-capturing-errors-in-trycatch-blocksAppVeyor: Discussion 2018-08-25T02:28:32Ztag:help.appveyor.com,2012-11-13:Comment/452292412018-05-07T17:09:36Z2018-05-07T17:09:36ZPowershell Capturing Errors in Try/Catch Blocks<div><p>Try using <code>$LastExitCode</code> as described <a href="https://www.appveyor.com/docs/build-configuration/#script-blocks-in-build-configuration">here</a>, but with your logic (fail build if script did not fail). Let us know if this helps.</p></div>Ilya Finkelshteyn