Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 3.0 » Set-PSBreakpoint

Set-PSBreakpoint - Powershell 3.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Set-PSBreakpoint

Short description
Sets a breakpoint on a line, command, or variable.

Syntax
Set-PSBreakpoint [-Script] <String[]> [-Line] <Int32[]> [[-Column] <Int32>] [-Action <ScriptBlock>] [<CommonParameters>
]
Set-PSBreakpoint [[-Script] <String[]>] [-Action <ScriptBlock>] -Command <String[]> [<CommonParameters>]
Set-PSBreakpoint [[-Script] <String[]>] [-Action <ScriptBlock>] [-Mode <VariableAccessMode>] -Variable <String[]> [<Com
monParameters>]





Description
The Set-PSBreakpoint cmdlet sets a breakpoint in a script or in any command run in the current session.  You can use Se
t-PSBreakpoint to set a breakpoint before executing a script or running a command, or during debugging, when stopped at
 another breakpoint.


Note: Set-PSBreakpoint cannot set a breakpoint on a remote computer. To debug a script on a remote computer, copy the s
cript to the local computer and then debug it locally.


Each Set-PSBreakpoint command creates one of the following three types of breakpoints:


-- Line breakpoint:  Sets breakpoints at particular line and column coordinates.


-- Command breakpoint:  Sets breakpoints on commands and functions.


-- Variable breakpoint: Sets breakpoints on variables.


You can set a breakpoint on multiple lines, commands, or variables in a single Set-PSBreakpoint command, but each Set-P
SBreakpoint command sets only one type of breakpoint.


At a breakpoint, Windows PowerShell temporarily stops executing and gives control to the debugger. The command prompt c
hanges to "DBG>", and a set of debugger commands become available for use. However, you can use the Action parameter to
 specify an alternate response, such as conditions for the breakpoint or instructions to perform additional tasks such 
as logging or diagnostics.


The Set-PSBreakpoint cmdlet is one of several cmdlets designed for debugging Windows PowerShell scripts. For more infor
mation about the Windows PowerShell debugger, see about_Debuggers.