Chapter 12. Handling errors

When it comes to handling errors in your script, you need to understand how the script will be used. The way that a script will be used is sometimes called the use case scenario, and it describes how the user will interact with the script.

If the use case scenario is simple, the user might not need to do anything more than type the name of the script inside the Windows PowerShell console. A script such as Get-Bios.ps1 can get by without much need for any error handling because there are no inputs to the script. The script is called, it runs, and it displays information ...

Get Windows PowerShell Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.