Skip to content

Commit fa3d170

Browse files
update enable-psbreakpoint v6, v5.1
1 parent c94ec26 commit fa3d170

File tree

2 files changed

+135
-124
lines changed

2 files changed

+135
-124
lines changed

reference/5.1/Microsoft.PowerShell.Utility/Enable-PSBreakpoint.md

Lines changed: 73 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
keywords: powershell,cmdlet
44
locale: en-us
55
Module Name: Microsoft.PowerShell.Utility
6-
ms.date: 06/09/2017
7-
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/enable-psbreakpoint?view=powershell-5.1&WT.mc_id=ps-gethelp
6+
ms.date: 10/09/2019
7+
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/enable-psbreakpoint?view=powershell-7&WT.mc_id=ps-gethelp
88
schema: 2.0.0
99
title: Enable-PSBreakpoint
1010
---
@@ -27,46 +27,59 @@ Enable-PSBreakpoint [-PassThru] [-Breakpoint] <Breakpoint[]> [-WhatIf] [-Confirm
2727
```
2828

2929
## DESCRIPTION
30-
The **Enable-PSBreakpoint** cmdlet re-enables disabled breakpoints.
31-
You can use it to enable all breakpoints, or you can specify breakpoints by submitting breakpoint objects or breakpoint IDs.
3230

33-
A breakpoint is a point in a script where execution stops temporarily so that you can examine the instructions in the script.
34-
Newly created breakpoints are automatically enabled, but you can disable them by using the Disable-PSBreakpoint cmdlet.
31+
The `Enable-PSBreakpoint` cmdlet re-enables disabled breakpoints. You can use it to enable all
32+
breakpoints, or specific breakpoints by providing breakpoint objects or IDs.
3533

36-
Technically, this cmdlet changes the value of the Enabled property of a breakpoint object to True.
34+
A breakpoint is a point in a script where execution stops temporarily so that you can examine the
35+
state of the script. Newly created breakpoints are automatically enabled, but can be disabled using
36+
`Disable-PSBreakpoint`.
3737

38-
**Enable-PSBreakpoint** is one of several cmdlets designed for debugging Windows PowerShell scripts.
39-
For more information about the Windows PowerShell debugger, see about_Debuggers.
38+
Technically, this cmdlet changes the value of the **Enabled** property of a breakpoint object to **True**.
39+
40+
`Enable-PSBreakpoint` is one of several cmdlets designed for debugging PowerShell scripts. For more
41+
information about the PowerShell debugger, see
42+
[about_Debuggers](../Microsoft.PowerShell.Core/About/About_Debuggers.md).
4043

4144
## EXAMPLES
4245

4346
### Example 1: Enable all breakpoints
44-
```
45-
PS C:\> Get-PSBreakpoint | Enable-PSBreakpoint
47+
48+
This example enables all breakpoints in the current session.
49+
50+
```powershell
51+
Get-PSBreakpoint | Enable-PSBreakpoint
4652
```
4753

48-
This command enables all breakpoints in the current console.
49-
You can abbreviate the command as `gbp | ebp`.
54+
Using aliases, this example can be abbreviated as `gbp | ebp`.
5055

5156
### Example 2: Enable breakpoints by ID
52-
```
53-
PS C:\> Enable-PSBreakpoint -Id 0, 1, 5
54-
```
5557

56-
This command enables breakpoints with breakpoint IDs 0, 1, and 5.
58+
This example enables multiple breakpoints using their breakpoint IDs.
59+
60+
```powershell
61+
Enable-PSBreakpoint -Id 0, 1, 5
62+
```
5763

5864
### Example 3: Enable a disabled breakpoint
65+
66+
This example re-enables a breakpoint that has been disabled.
67+
68+
```powershell
69+
$B = Set-PSBreakpoint -Script "sample.ps1" -Variable Name -PassThru
70+
$B | Enable-PSBreakpoint -PassThru
5971
```
60-
PS C:\> $B = Set-PSBreakpoint -Script "sample.ps1" -Variable Name
61-
PS C:\> $B | Disable-PSBreakpoint -PassThru
72+
73+
```Output
6274
AccessMode : Write
6375
Variable : Name
6476
Action :
6577
Enabled : False
6678
HitCount : 0
6779
Id : 0
6880
Script : C:\ps-test\sample.ps1
69-
ScriptName : C:\ps-test\sample.ps1 PS C:\> $B | Enable-PSBreakpoint -PassThru
81+
ScriptName : C:\ps-test\sample.ps1
82+
7083
AccessMode : Write
7184
Variable : Name
7285
Action :
@@ -77,41 +90,34 @@ Script : C:\ps-test\sample.ps1
7790
ScriptName : C:\ps-test\sample.ps1
7891
```
7992

80-
These commands re-enable a breakpoint that has been disabled.
81-
82-
The first command uses the Set-PSBreakpoint cmdlet to create a breakpoint on the Name variable in the Sample.ps1 script.
83-
Then, it saves the breakpoint object in the $B variable.
93+
`Set-PSBreakpoint` creates a breakpoint on the **Name** variable in the `Sample.ps1` script saving
94+
the breakpoint object in the `$B` variable. The **PassThru** parameter displays the value of the
95+
**Enabled** property of the breakpoint is **False**.
8496

85-
The second command uses the Disable-PSBreakpoint cmdlet to disable the new breakpoint.
86-
It uses a pipeline operator (|) to send the breakpoint object in $B to the **Disable-PSBreakpoint** cmdlet, and it uses the *PassThru* parameter of **Disable-PSBreakpoint** to display the disabled breakpoint object.
87-
This lets you verify that the value of the Enabled property of the breakpoint object is False.
97+
`Enable-PSBreakpoint` re-enables the breakpoint and using the **PassThru** parameter to display the
98+
value of the **Enabled** property is **True**.
8899

89-
The third command uses the **Enable-PSBreakpoint** cmdlet to re-enable the breakpoint.
90-
It uses a pipeline operator (|) to send the breakpoint object in $B to the **Enable-PSBreakpoint** cmdlet, and it uses the *PassThru* parameter of **Enable-PSBreakpoint** to display the breakpoint object.
91-
This lets you verify that the value of the Enabled property of the breakpoint object is True.
100+
### Example 4: Enable breakpoints using a variable
92101

93-
The results are shown in the following sample output.
102+
This example enables a set of breakpoints using the breakpoint objects.
94103

95-
### Example 4: Enable breakpoints using a variable
104+
```powershell
105+
$B = Get-PSBreakpoint -Id 3, 5
106+
Enable-PSBreakpoint -Breakpoint $B
96107
```
97-
PS C:\> $B = Get-PSBreakpoint -Id 3, 5
98-
PS C:\> Enable-PSBreakpoint -Breakpoint $B
99-
```
100-
101-
These commands enable a set of breakpoints by specifying their breakpoint objects.
102108

103-
The first command uses the Get-PSBreakpoint cmdlet to get the breakpoints and saves them in the $B variable.
109+
`Get-PSBreakpoint` gets breakpoints by ID number and stores them in the `$B` variable.
104110

105-
The second command uses the **Enable-PSBreakpoint** cmdlet and its *Breakpoint* parameter to enable the breakpoints.
111+
`Enable-PSBreakpoint` enables the breakpoints stored in `$B` using the **Breakpoint** parameter.
106112

107-
This command is the equivalent of `Enable-PSBreakpoint -Id 3, 5`.
113+
This example is the equivalent of `Enable-PSBreakpoint -Id 3, 5`.
108114

109115
## PARAMETERS
110116

111117
### -Breakpoint
112-
Specifies the breakpoints to enable.
113-
Enter a variable that contains breakpoint objects or a command that gets breakpoint objects, such as a Get-PSBreakpoint command.
114-
You can also pipe breakpoint objects to **Enable-PSBreakpoint**.
118+
119+
Specifies the breakpoints to enable. Provide a variable or a command, such as `Get-PSBreakpoint`,
120+
that contains breakpoint objects. You can also pipe breakpoint objects to `Enable-PSBreakpoint`.
115121

116122
```yaml
117123
Type: Breakpoint[]
@@ -126,11 +132,10 @@ Accept wildcard characters: False
126132
```
127133
128134
### -Id
129-
Specifies breakpoint IDs that this cmdlet enables.
130-
The default value is all breakpoints.
131-
Enter the IDs or a variable that contains the IDs.
132-
You cannot use the pipeline to send IDs to **Enable-PSBreakpoint**.
133-
To find the ID of a breakpoint, use the Get-PSBreakpoint cmdlet.
135+
136+
Specifies breakpoint **ID** numbers to enable. The default value is all breakpoints. Provide a list
137+
or variable that contains **ID** numbers. You cannot use the pipeline to send **ID** numbers to
138+
`Enable-PSBreakpoint`. To find the **ID** number of a breakpoint, use the `Get-PSBreakpoint` cmdlet.
134139

135140
```yaml
136141
Type: Int32[]
@@ -145,8 +150,9 @@ Accept wildcard characters: False
145150
```
146151

147152
### -PassThru
148-
Returns an object representing the item with which you are working.
149-
By default, this cmdlet does not generate any output.
153+
154+
Returns an object representing the item with which you are working. By default, this cmdlet does not
155+
generate any output.
150156

151157
```yaml
152158
Type: SwitchParameter
@@ -176,8 +182,8 @@ Accept wildcard characters: False
176182
```
177183

178184
### -WhatIf
179-
Shows what would happen if the cmdlet runs.
180-
The cmdlet is not run.
185+
186+
Shows what would happen if the cmdlet runs. The cmdlet is not run.
181187

182188
```yaml
183189
Type: SwitchParameter
@@ -192,26 +198,33 @@ Accept wildcard characters: False
192198
```
193199

194200
### CommonParameters
195-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
201+
202+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
203+
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
204+
-WarningAction, and -WarningVariable. For more information, see
205+
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
196206

197207
## INPUTS
198208

199209
### System.Management.Automation.Breakpoint
200-
You can pipe a breakpoint object to **Enable-PSBreakpoint**.
210+
211+
You can pipe a breakpoint object to `Enable-PSBreakpoint`.
201212

202213
## OUTPUTS
203214

204215
### None or System.Management.Automation.Breakpoint
205-
When you use the *PassThru* parameter, **Enable-PSBreakpoint** returns a breakpoint object that represent that breakpoint that was enabled.
206-
Otherwise, this cmdlet does not generate any output.
216+
217+
When you use the **PassThru** parameter, `Enable-PSBreakpoint` returns a result that the breakpoint
218+
is enabled. Otherwise, this does not generate any output.
207219

208220
## NOTES
209-
* The **Enable-PSBreakpoint** cmdlet does not generate an error if you try to enable a breakpoint that is already enabled. As such, you can enable all breakpoints without error, even when only a few are disabled.
210221

211-
Breakpoints are enabled when you create them by using the Set-PSBreakpoint cmdlet.
212-
You do not need to enable newly created breakpoints.
222+
- The `Enable-PSBreakpoint` cmdlet does not generate an error if you try to enable a breakpoint that
223+
is already enabled. As such, you can enable all breakpoints without error, even when only a few
224+
are disabled.
213225

214-
*
226+
- Breakpoints are enabled when you create them by using the `Set-PSBreakpoint` cmdlet. You do not
227+
need to enable newly created breakpoints.
215228

216229
## RELATED LINKS
217230

@@ -224,5 +237,3 @@ You do not need to enable newly created breakpoints.
224237
[Remove-PSBreakpoint](Remove-PSBreakpoint.md)
225238

226239
[Set-PSBreakpoint](Set-PSBreakpoint.md)
227-
228-

0 commit comments

Comments
 (0)