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.
ReTweet this Tip!
Posted
Oct 12 2010, 08:00 AM
by
ps1