Chapter 15. Debugging

This chapter covers

  • Creating script instrumentation
  • Capturing session output
  • The PowerShell debugger
  • Command-line debugging
  • Debugging PowerShell jobs, runspaces, and remote scripts

Big Julie: “I had the numbers taken off for luck, but I remember where the spots formerly were.”

Guys and Dolls, words and music by Frank Loesser

No one writes code that always works correctly the first time it’s run. When the worst happens and your code won’t run, or deliver the correct results, you need to debug it to find the problem or problems. Start by adding statements that track your code’s execution and capture session output and then move on to more advanced techniques using the PowerShell debugger on running code. The techniques ...

Get Windows PowerShell in Action, Third 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.