Error Handling, Part 1: Overview

It happens to all of us: our perfect script will run in to something it doesn't understand, doesn't know how to deal with, and out comes the red text.  It was probably something simple, like someone mistyped the command, or that file was moved by someone trying to be "helpful".

Whatever the reason, you find yourself looking at a garbled mess of angry red text.  Or, even worse: it was a script you had running automatically, and now you have no idea what went wrong.  Fortunately, PowerShell comes with many ways to deal with errors.

Error Handling isn't a sexy or fun topic, but it is vital to writing good scripts.  In this series, I hope to give you enough to get started.

Read More