Get the breakpoints that are set in the current session, for debugging a .ps1 script.
Syntax Get-PSBreakpoint [[-Script] string] [CommonParameters] Get-PSBreakpoint -Command string [-Script string] [CommonParameters] Get-PSBreakpoint [-Id] Int32 [CommonParameters] Get-PSBreakpoint [-Type] BreakpointType [-Script string] [CommonParameters] Get-PSBreakpoint -Variable string [-Script string] [CommonParameters] Key -Command string Get command breakpoints that are set on the specified command names. Enter the command names, such as the name of a cmdlet or function. -Id Int32 Get the breakpoints with the specified breakpoint IDs. Enter the IDs in a comma-separated list. You can pipe breakpoint IDs to Get-PSBreakpoint. -Script string Get only the breakpoints in the specified scripts. Enter the path (optional) and names of one or more script files. The default location is the current directory. -Type BreakpointType Get 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. -Variable string Get variable breakpoints that are set on the specified variable names. Enter the variable names without dollar signs.
Standard Aliases for Get-PSBreakpoint: gbp
A breakpoint is a point in a command or script where execution stops temporarily so that you can examine the instructions.
Get all breakpoints set on all scripts and functions in the current session:
PS C:> get-psbreakpoint
Get the breakpoint with breakpoint ID 2:
PS C:> get-psbreakpoint -Id 2
Get a breakpoint on the ss64 function in demo.ps1 by piping a breakpoint ID:
PS C:> $brk = set-psbreakpoint -script demo.ps1 -function ss64
PS C:> $brk.Id | get-psbreakpoint
Get all breakpoints for the scripts Demo1 and Demo2.ps1:
PS C:> get-psbreakpoint -script Demo1.ps1, Demo2.ps1
Get all breakpoints that are set on Read-Host or Write-Host commands in the Demo1.ps1 file:
PS C:> get-psbreakpoint -command Read-Host, Write-Host -script Demo1.ps1
Get all the Command breakpoints in Demo1.ps1:
PS C:> get-psbreakpoint -type Command -script Demo1.ps1
Get breakpoints that are set on the $var1 and $var2 variables in the current session.:
PS C:> get-psbreakpoint -variable var1, var2
Get all line and variable breakpoints in Demo1.ps1:
PS C:> get-psbreakpoint -type line, variable -script Demo1.ps1
“Better bend than break” ~ Scottish Proverb
Enable-PSBreakpoint - Enable breakpoints in the current console