September 16th, 2015

PowerTip: Check What PowerShell Does When Error Occurs

Doctor Scripto
Scripter

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
Continue

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback