O'Reilly logo

PowerShell Troubleshooting Guide by Michael Shepard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Reactive Practices – Traditional Debugging

So far, we have focused on making the code easier to troubleshoot. This chapter will introduce the techniques used to troubleshoot the code while it's running. We will see that the investment we've put into the proper design and implementation of our code will make the job of troubleshooting much easier. The specific techniques that we will cover in this chapter are as follows:

  • Reading error messages
  • Using Set-PSDebug
  • Debugging in the ISE (or other integrated environment)
  • Debugging in the console
  • Event logs
  • The PSDiagnostics module
  • Using –confirm and –whatif
  • Reducing input size
  • Using Tee-Object
  • Replacing the foreach loop with the foreach-object cmdlet

Reading error messages

This section shouldn't be

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required