PowerShell is a strange combination of .bat and .NET. In .bat, you check for error output and stderr output from commands. In .NET, you encounter exceptions.
How do cmdlets return errors? Do they throw exceptions when they fail or do they set $? instead? Is this customizable?
I also assume that the .NET functions that I call in PowerShell will always throw exceptions and will not automatically get into the shell and convert to errors. It is right?
Maybe I should really ask: what is a good article that covers all this? It looks like I have a lot of engineers, I have experience in cmd.bat and .NET. They wonder how we should do something in this bold new world of Posh.
exception powershell error-handling
scobi
source share