about_debuggers.help - TOPIC about_Debuggers SHORT...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 TOPIC about_Debuggers SHORT DESCRIPTION Describes the Windows PowerShell debugger. LONG DESCRIPTION Debugging is the process of examining a script while it is running in order to identify and correct errors in the script instructions. The Windows PowerShell debugger is designed to help you examine and identify errors and inefficiencies in your scripts. Note: The Windows PowerShell debugger does not run remotely. To debug a script on a remote computer, copy the script to the local computer. You can use the features of the Windows PowerShell debugger to examine a Windows PowerShell script, function, command, or expression while it is running. The Windows PowerShell debugger includes a set of cmdlets that let you set breakpoints, manage breakpoints, and view the call stack. Windows PowerShell offers several methods that you can use to debug scripts, functions, and commands. Method 1: The Set-PsDebug cmdlet offers basic script debugging features, including stepping and tracing. For more information, type: "get-help set-psdebug". Method 2: Use the Set-StrictMode cmdlet to detect references to uninitialized variables, to references to non-existent properties of an object, and to function syntax that is not valid. Method 3: Add diagnostic statements to a script, such as statements that display the value of variables, statements that read input from the command line, or statements that report the current instruction. Use the cmdlets that contain the Write verb for this task, such as Write-Host, Write-Debug, Write-Warning, and Write-Verbose. Method 4: Use the Windows PowerShell debugger to debug a script. Or, use the debugger to debug a function or script block that you typed at the command prompt. You can set breakpoints, step through the script, examine the values of variables, run diagnostics and logging commands, and display the call stack.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 Debugger Cmdlets The Windows PowerShell debugger includes the following set of cmdlets: Set-PsBreakpoint: Sets breakpoints on lines, variables, and commands. Get-PsBreakpoint: Gets breakpoints in the current session. Disable-PsBreakpoint: Turns off breakpoints in the current session. Enable-PsBreakpoint: Re-enables breakpoints in the current session. Remove-PsBreakpoint: Deletes breakpoints from the current session. Get-PsCallStack: Displays the current call stack. Starting and Stopping the Debugger To start the debugger, set one or more breakpoints. Then, run the script, command, or function that you want to debug. When you reach a breakpoint, execution stops, and control is turned over to the debugger. To stop the debugger, run the script, command, or function until it is complete. Or, type "stop" or "t". Debugger Commands
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/03/2010 for the course BUS fin taught by Professor Fez during the Spring '10 term at Valparaiso.

Page1 / 11

about_debuggers.help - TOPIC about_Debuggers SHORT...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online