PowerTip: Specifying PowerShell Error Actions

Doctor Scripto

Summary: Specify Windows PowerShell error actions. Question: Which command when typed at the beginning of a script will cause Windows PowerShell to ignore errors and continue executing the code?

Answer: $erroractionpreference=SilentlyContinue Question: How can I ignore errors for a single command instead of for the entire script?

Answer: Use the ErrorAction parameter and specify one of the following values: SilentlyContinue, . Question: That is a lot of typing. Is there an easier way to specify the ErrorAction for a single command?

Answer: Yes. You can use the parameter alias EA and use a number value for the action. For example, 0 is SilentlyContinue, 1 is Stop, 2 is Continue, 3 is Inquire, or 4 is Ignore.


Discussion is closed.

Feedback usabilla icon