O'Reilly logo

Windows PowerShell™ 3.0 Step by Step by Ed Wilson

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

Debugging a function: step-by-step exercises

In this exercise, you will explore the use of the debugger in the Windows PowerShell ISE. (Note that if you have defined your own custom Windows PowerShell prompt, you may not see the [DBG] prompt portion of the Windows PowerShell prompt.) Once you have completed debugging a function, in the subsequent exercise you will debug a script.

Using the PowerShell debugger to debug a function

  1. Open the Windows PowerShell ISE.

  2. Create a function called My-Function. The contents of the function appear following. Save the function to a file named my-function.ps1. (If you do not save the file, you are not running a script, and you will not enter the debugger.)

    Function my-function { Param( [int]$a, [int]$b) "$a ...

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