Enable a breakpoint (or several breakpoints) in the current console, for debugging a .ps1 script.
Syntax
Enable-PSBreakpoint [-Id] Int32[]
[-PassThru] [-Confirm] [-WhatIf] [CommonParameters]
Enable-PSBreakpoint [-Breakpoint] Breakpoint[]
[-PassThru] [-Confirm] [-WhatIf] [CommonParameters]
Key
-Breakpoint Breakpoint[]
The breakpoints to enable. Enter a variable that contains breakpoint
objects or a command that gets breakpoint objects, (Get-PSBreakpoint).
You can also pipe breakpoint objects.
-Id Int32[]
Enable breakpoints with the specified breakpoint IDs.
Enter the IDs or a variable that contains the IDs.
You cannot pipe IDs to Disable-PSBreakpoint.
-PassThru
Return an object representing the enabled breakpoints.
By default, this cmdlet does not generate any output.
-confirm
Prompt for confirmation before executing the command.
-whatIf
Describe what would happen if you executed the command without actually
executing the command.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
-OutBuffer -OutVariable.
Standard Aliases for Enable-PSBreakpoint: ebp
Examples
Enable breakpoints id 0 and id 5:
PS C:> enable-psbreakpoint -id 0,5
Enable breakpoints 1 and 3:
PS C:> $bpoint = get-psbreakpoint -id 1, 3
PS C:> enable-psbreakpoint -breakpoint $bpoint
Create, disable and then enable a breakpoint on the "ss64" variable in the script demo.ps1:
PS C:> $brk = set-psbreakpoint -script demo.ps1 -variable ss64 PS C:> $brk | disable-psbreakpoint -passthru ... PS C:> $brk | enable-psbreakpoint -passthru
Enable all breakpoints in the current console:
PS C:> get-psbreakpoint | enable-psbreakpoint
“The heart is the only broken instrument that works” ~ T. E. Kalem
Related PowerShell Cmdlets:
Disable-PSBreakpoint - Disable a breakpoint in the current console.
Get-PSBreakpoint - Get the currently set breakpoints.
How to Debug Scripts in Windows PowerShell ISE.