Take Control of Errors
Take Control of Errors
Let's wrap up our exploration of common parameters with a look at how you can manage errors. While I think you should take advantage of common parameters when running PowerShell commands in the console, I think you should be even more aggressive about using them in your scripts. The ErrorAction
and ErrorVariable
parameters are two of the most important parameters you can use to manage errors in your scripts.
Errors are not necessarily bad. The error itself can provide useful information. Even the fact that an error occurred can be informative. Don't be afraid of errors or dismiss them out of hand. Embrace them and use them to make your scripts and PowerShell work better.
Pipelines
Want to read the full issue?