Book Image

PowerShell Troubleshooting Guide

By : Mike Shepard
Book Image

PowerShell Troubleshooting Guide

By: Mike Shepard

Overview of this book

Table of Contents (15 chapters)
PowerShell Troubleshooting Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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