Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Get-PSBreakpoint

Updated: October 17, 2013

Applies To: Windows PowerShell 4.0

Get-PSBreakpoint

Gets the breakpoints that are set in the current session.

Syntax

Parameter Set: Script
Get-PSBreakpoint [[-Script] <String[]> ] [ <CommonParameters>]

Parameter Set: Command
Get-PSBreakpoint -Command <String[]> [-Script <String[]> ] [ <CommonParameters>]

Parameter Set: Id
Get-PSBreakpoint [-Id] <Int32[]> [ <CommonParameters>]

Parameter Set: Type
Get-PSBreakpoint [-Type] <BreakpointType[]> [-Script <String[]> ] [ <CommonParameters>]

Parameter Set: Variable
Get-PSBreakpoint -Variable <String[]> [-Script <String[]> ] [ <CommonParameters>]




Detailed Description

The Get-PSBreakPoint cmdlet gets the breakpoints that are set in the current session. You can use the cmdlet parameters to get particular breakpoints.

A breakpoint is a point in a command or script where execution stops temporarily so that you can examine the instructions. Get-PSBreakpoint is one of several cmdlets designed for debugging Windows PowerShell scripts and commands. For more information about the Windows PowerShell debugger, see about_Debuggers.

Parameters

-Command<String[]>

Gets command breakpoints that are set on the specified command names. Enter the command names, such as the name of a cmdlet or function.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Id<Int32[]>

Gets the breakpoints with the specified breakpoint IDs. Enter the IDs in a comma-separated list. You can also pipe breakpoint IDs to Get-PSBreakpoint.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-Script<String[]>

Gets only the breakpoints in the specified scripts. Enter the path (optional) and names of one or more script files. If you omit the path, the default location is the current directory.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Type<BreakpointType[]>

Gets only breakpoints of the specified types. Enter one or more types. Valid values are Line, Command, and Variable. You can also pipe breakpoint types to Get-PSBreakpoint.


Aliases

none

Required?

true

Position?

1

Default Value

All types

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-Variable<String[]>

Gets variable breakpoints that are set on the specified variable names. Enter the variable names without dollar signs.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • System.Int32, Microsoft.PowerShell.Commands.BreakpointType

    You can pipe breakpoint IDs and breakpoint types to Get-PSBreakpoint.


Outputs

The output type is the type of the objects that the cmdlet emits.

Notes

  • You can use Get-PSBreakpoint or its alias, "gbp".

Examples

-------------------------- EXAMPLE 1 --------------------------

Description

-----------

This command gets all breakpoints set on all scripts and functions in the current session.


C:\PS>get-psbreakpoint

-------------------------- EXAMPLE 2 --------------------------

Description

-----------

This command gets the breakpoint with breakpoint ID 2.


C:\PS>get-psbreakpoint -Id 2Function   : IncrementAction     :Enabled    : TrueHitCount   : 0Id         : 2Script     : C:\ps-test\sample.ps1ScriptName : C:\ps-test\sample.ps1

-------------------------- EXAMPLE 3 --------------------------

Description

-----------

These commands show how to get a breakpoint by piping a breakpoint ID to Get-PSBreakpoint.

The first command uses the Set-PSBreakpoint cmdlet to create a breakpoint on the Increment function in the Sample.ps1 script. It saves the breakpoint object in the $b variable.

The second command uses the dot operator (.) to get the Id property of the breakpoint object in the $b variable. It uses a pipeline operator (|) to send the ID to the Get-PSBreakpoint cmdlet.

As a result, Get-PSBreakpoint gets the breakpoint with the specified ID.


C:\PS>$b = set-psbreakpoint -script sample.ps1 -function incrementPS C:\> $b.Id | get-psbreakpoint

-------------------------- EXAMPLE 4 --------------------------

Description

-----------

This command gets all of the breakpoints in the Sample.ps1 and SupportScript.ps1 files.

This command does not get other breakpointS that might be set in other scripts or on functions in the session.


C:\PS>get-psbreakpoint -script Sample.ps1, SupportScript.ps1

-------------------------- EXAMPLE 5 --------------------------

Description

-----------

This command gets all Command breakpoints that are set on Read-Host or Write-Host commands in the Sample.ps1 file.


C:\PS>get-psbreakpoint -command Read-Host, Write-Host -script Sample.ps1

-------------------------- EXAMPLE 6 --------------------------

Description

-----------

This command gets all Command breakpoints in the Sample.ps1 file.


C:\PS>get-psbreakpoint -type Command -script Sample.ps1

-------------------------- EXAMPLE 7 --------------------------

Description

-----------

This command gets breakpoints that are set on the $index and $swap variables in the current session.


C:\PS>get-psbreakpoint -variable Index, Swap

-------------------------- EXAMPLE 8 --------------------------

Description

-----------

This command gets all line and variable breakpoints in the Sample.ps1 script.


C:\PS>get-psbreakpoint -type line, variable -script Sample.ps1

Related topics



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.