This chapter displays how to properly incorporate error and exception handling in your scripts. You explored how to leverage built-in cmdlet parameters for error and exception handling, and how to work with warnings and errors in your scripts. You also learned the Try/Catch
block and how to use that to catch errors outside of what cmdlets can handle. You also learned how to use the cmdlet parameter for error and exception handling in conjunction with the Try/Catch
block to provide robust solutions for catching issues in your scripts.
This chapter also explored methods with which you can work with legacy command-line tools and catch error messages from these tools. You learned that while the legacy tools may not have robust exception handling, PowerShell is dynamic enough to catch the errors and parse it for use in your scripts. You learned that PowerShell will automatically take multiple lines from an error message from a legacy command-line tool and place them as new items in an...