In my PowerShell script I'm calling some command line tools (not cmdlets) that may output error text and set errorlevel nonzero on error conditions. I'd like any error from any of these tools to abort my script.
What's the best way to do this?
Is there a way to have PowerShell automatically check $? and stderr after every command and throw an exception? I was thinking something along the lines of "on error" that 4NT or VBScript has - a global watch. Not very object-orienty, so I was hoping PowerShell had something better.
[Edit: last couple questions moved to here.]