PowerTip: Check What PowerShell Does When Error Occurs

Doctor Scripto

Summary: See what Windows PowerShell will do when an error occurs.

Hey, Scripting Guy! Question How can I check the setting so I will know what Windows PowerShell will do if an error occurs?

Hey, Scripting Guy! Answer Look for the value of the $ErrorActionPreference. By default, it is set to Continue, which means it will
           attempt to execute the next command. Other values are StopInquire, and Ignore.
           Here is an example of the command:

PS C:\> $ErrorActionPreference


Discussion is closed.

Feedback usabilla icon