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

Debugging in the ISE


We've already discussed the use of Set-PSDebug in the ISE, so we know that we can use the –Trace and –Step parameters to get extra output and control options as the script runs in the ISE. As simple as using Set-PSDebug is, debugging in the ISE using the GUI is probably used more often than in the console. This is due to the simple point-and-click operation of the ISE. As in most development environments, a breakpoint can be set on a line of code by right-clicking on a line and selecting Toggle Breakpoint from the context menu:

When a breakpoint has been set, the line will be highlighted in red, as shown in the following screenshot:

When a breakpoint is reached in the ISE, the script containing the breakpoint is loaded in the ISE if it isn't already loaded, and the cursor is placed at the position of the breakpoint. The current line is highlighted yellow, as shown in the following screenshot:

Once a breakpoint has been reached, the ISE has some additional features to...