Trap [Exception] { “In PowerShell” }

This is a great example of how to use Trap and Throw in PowerShell to handle errors besides using SilentlyContinue and $?.

Also there is a great blog post on the PowerShell Blog where they talk about the PowerShell: TFM book and Chapter 11 Covers this very topic along with others ( http://blogs.msdn.com/powershell/archive/2006/12/29/documenting-trap-and-throw.aspx ).

Trap [Exception] { “In PowerShell” }

Comments

No Comments