14

Troubleshooting with PowerShell

In this chapter, we cover the following recipes:

  • Using PowerShell Script Analyzer
  • Using Best Practices Analyzer
  • Network troubleshooting
  • Checking network connectivity using Get-NetView
  • Exploring PowerShell script debugging

Introduction

You can think about debugging as the art and science of removing bugs from your PowerShell scripts. You may find your script does not always do what you or your users want, both during the development of the script and later, after you have used it in production. Troubleshooting is a process you go through to determine why your script is not doing what you want (and helps you resolve your issues with the script).

There are three broad classes of problems that you encounter: ...

Get Windows Server Automation with PowerShell Cookbook - Fourth Edition 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.