Change ErrorAction for Your Private Error Handling

by Oct 12, 2010

When you handle errors yourself using Trap or try/catch, you should make sure that you set your ErrorActionPreference to “Stop” or specify -ErrorAction Stop for each cmdlet you want to handle. Otherwise, Cmdlet exceptions would be invisible to your error handlers and handled by PowerShell automatically.

Twitter This Tip!
ReTweet this Tip!