Export (0) Print
Expand All

Disable-PSBreakpoint

Updated: May 8, 2014

Applies To: Windows PowerShell 4.0

Disable-PSBreakpoint

Disables the breakpoints in the current console.

Aliases

The following abbreviations are aliases for this cmdlet:

  • dbp

Syntax

Parameter Set: Breakpoint
Disable-PSBreakpoint [-Breakpoint] <Breakpoint[]> [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: Id
Disable-PSBreakpoint [-Id] <Int32[]> [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]




Detailed Description

The Disable-PSBreakpoint cmdlet disables breakpoints, which assures that they are not hit when the script runs. You can use it to disable all breakpoints, or you can specify breakpoints by submitting breakpoint objects or breakpoint IDs.

Technically, this cmdlet changes the value of the Enabled property of a breakpoint object to False. To re-enable a breakpoint, use the Enable-PSBreakpoint cmdlet. Breakpoints are enabled by default when you create them by using the Set-PSBreakpoint cmdlet.

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

Parameters

-Breakpoint<Breakpoint[]>

Specifies the breakpoints to disable. Enter a variable that contains breakpoint objects or a command that gets breakpoint objects, such as a Get-PSBreakpoint command. You can also pipe breakpoint objects to the Disable-PSBreakpoint cmdlet.


Aliases

none

Required?

true

Position?

1

Default Value

None

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Id<Int32[]>

Disables the breakpoints with the specified breakpoint IDs. Enter the IDs or a variable that contains the IDs. You cannot pipe IDs to Disable-PSBreakpoint.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-PassThru

Returns an object representing the enabled breakpoints. By default, this cmdlet does not generate any output.


Aliases

none

Required?

false

Position?

named

Default Value

False

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.


Required?

false

Position?

named

Default Value

false

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.Management.Automation.Breakpoint

    You can pipe a breakpoint object to Disable-PSBreakpoint.


Outputs

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

  • None or System.Management.Automation.Breakpoint

    When you use the PassThru parameter, Disable-PSBreakpoint returns an object that represents the disabled breakpoint. Otherwise, this cmdlet does not generate any output.


Examples

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

These commands disable a newly-created breakpoint.

The first command uses the Set-PSBreakpoint cmdlet to create a breakpoint on the Name variable in the Sample.ps1 script. Then, it saves the breakpoint object in the $b variable.

The second command uses the Disable-PSBreakpoint cmdlet to disable the new breakpoint. It uses a pipeline operator (|) to send the breakpoint object in $b to the Disable-PSBreakpoint cmdlet.

As a result of this command, the value of the Enabled property of the breakpoint object in $b is False.


PS C:\> $b = set-psbreakpoint -script sample.ps1 -variable name
PS C:\>$b | disable-psbreakpoint

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

This command disables the breakpoint with breakpoint ID 0.


PS C:\> disable-psbreakpoint -id 0

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

This command creates a new breakpoint that is disabled until you enable it.

It uses the Disable-PSBreakpoint cmdlet to disable the breakpoint. The value of the Breakpoint parameter is a Set-PSBreakpoint command that sets a new breakpoint, generates a breakpoint object, and saves the object in the $b variable.

Cmdlet parameters that take objects as their values can accept a variable that contains the object or a command that gets or generates the object. In this case, because Set-PSBreakpoint generates a breakpoint object, it can be used as the value of the Breakpoint parameter.

The second command displays the breakpoint object in the value of the $b variable.


PS C:\> disable-psbreakpoint -breakpoint ($b = set-psbreakpoint -script sample.ps1 -line 5)
PS C:\>$b

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

This command disables all breakpoints in the current console. You can abbreviate this command as: "gbp | dbp".


PS C:\> get-psbreakpoint | disable-psbreakpoint

Related topics



Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft