Change ErrorAction for Your Private Error Handling

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!


Posted Oct 12 2010, 08:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.