Automating the world one-liner at a time…
Someone as asking about Traps vs Try/Catch and Jason Shirk (PowerShell developer) gave a nice concise and precise answer that I thought I would share with you:
Enjoy!
Jeffrey Snover [MSFT] Distinguished Engineer Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
Which construct handles errors first? If I throw in a try block, does the catch get the first shot at handling the exception (what I would expect), or does the trap immediately nab it (what I think I'm seeing)?