Skip to content

Commit 7eb90eb

Browse files
authored
Merge pull request #4917 from theJasonHelmick/JCH-Enable-PSBreakpoint
Update Enable-PSBreakpoint
2 parents 30dd08d + 2293cf8 commit 7eb90eb

File tree

6 files changed

+430
-417
lines changed

6 files changed

+430
-417
lines changed

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

Lines changed: 65 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
keywords: powershell,cmdlet
44
locale: en-us
5-
ms.date: 06/09/2017
5+
Module Name: Microsoft.PowerShell.Utility
6+
ms.date: 10/09/2019
67
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/enable-psbreakpoint?view=powershell-3.0&WT.mc_id=ps-gethelp
78
schema: 2.0.0
89
title: Enable-PSBreakpoint
910
---
11+
1012
# Enable-PSBreakpoint
1113

1214
## SYNOPSIS
13-
1415
Enables the breakpoints in the current console.
1516

1617
## SYNTAX
@@ -24,47 +25,55 @@ Enable-PSBreakpoint [-PassThru] [-Id] <Int32[]> [-WhatIf] [-Confirm] [<CommonPar
2425
### Breakpoint
2526

2627
```
27-
Enable-PSBreakpoint [-PassThru] [-Breakpoint] <Breakpoint[]> [-WhatIf] [-Confirm] [<CommonParameters>]
28+
Enable-PSBreakpoint [-PassThru] [-Breakpoint] <Breakpoint[]> [-WhatIf] [-Confirm]
29+
[<CommonParameters>]
2830
```
2931

3032
## DESCRIPTION
3133

32-
The Enable-PSBreakpoint cmdlet re-enables disabled breakpoints.
33-
You can use it to enable all breakpoints, or you can specify breakpoints by submitting breakpoint objects or breakpoint IDs.
34+
The `Enable-PSBreakpoint` cmdlet re-enables disabled breakpoints. You can use it to enable all
35+
breakpoints, or specific breakpoints by providing breakpoint objects or IDs.
3436

35-
A breakpoint is a point in a script where execution stops temporarily so that you can examine the instructions in the script.
36-
Newly created breakpoints are automatically enabled, but you can disable them by using the Disable-PSBreakpoint cmdlet.
37+
A breakpoint is a point in a script where execution stops temporarily so that you can examine the
38+
state of the script. Newly created breakpoints are automatically enabled, but can be disabled using
39+
`Disable-PSBreakpoint`.
3740

38-
Technically, this cmdlet changes the value of the Enabled property of a breakpoint object to True.
41+
Technically, this cmdlet changes the value of the **Enabled** property of a breakpoint object to
42+
**True**.
3943

40-
Enable-PSBreakpoint is one of several cmdlets designed for debugging Windows PowerShell scripts.
41-
For more information about the Windows PowerShell debugger, see about_Debuggers.
44+
`Enable-PSBreakpoint` is one of several cmdlets designed for debugging PowerShell scripts. For more
45+
information about the PowerShell debugger, see [about_Debuggers](../Microsoft.PowerShell.Core/About/about_Debuggers.md).
4246

4347
## EXAMPLES
4448

45-
### Example 1
49+
### Example 1: Enable all breakpoints
50+
51+
This example enables all breakpoints in the current session.
4652

4753
```powershell
4854
Get-PSBreakpoint | Enable-PSBreakpoint
4955
```
5056

51-
This command enables all breakpoints in the current console.
52-
You can abbreviate the command as "gbp | ebp".
57+
Using aliases, this example can be abbreviated as `gbp | ebp`.
5358

54-
### Example 2
59+
### Example 2: Enable breakpoints by ID
60+
61+
This example enables multiple breakpoints using their breakpoint IDs.
5562

5663
```powershell
5764
Enable-PSBreakpoint -Id 0, 1, 5
5865
```
5966

60-
This command enables breakpoints with breakpoint IDs 0, 1, and 5.
67+
### Example 3: Enable a disabled breakpoint
6168

62-
### Example 3
69+
This example re-enables a breakpoint that has been disabled.
6370

71+
```powershell
72+
$B = Set-PSBreakpoint -Script "sample.ps1" -Variable Name -PassThru
73+
$B | Enable-PSBreakpoint -PassThru
6474
```
65-
PS> $b = set-psbreakpoint -script sample.ps1 -variable Name
66-
PS> $b | disable-psbreakpoint -passthru
6775

76+
```Output
6877
AccessMode : Write
6978
Variable : Name
7079
Action :
@@ -74,8 +83,6 @@ Id : 0
7483
Script : C:\ps-test\sample.ps1
7584
ScriptName : C:\ps-test\sample.ps1
7685
77-
PS> $b | enable-psbreakpoint -passthru
78-
7986
AccessMode : Write
8087
Variable : Name
8188
Action :
@@ -86,79 +93,69 @@ Script : C:\ps-test\sample.ps1
8693
ScriptName : C:\ps-test\sample.ps1
8794
```
8895

89-
These commands re-enable a breakpoint that has been disabled.
96+
`Set-PSBreakpoint` creates a breakpoint on the **Name** variable in the `Sample.ps1` script saving
97+
the breakpoint object in the `$B` variable. The **PassThru** parameter displays the value of the
98+
**Enabled** property of the breakpoint is **False**.
9099

91-
The first command uses the Set-PSBreakpoint cmdlet to create a breakpoint on the "Name" variable in the Sample.ps1 script.
92-
Then, it saves the breakpoint object in the $b variable.
100+
`Enable-PSBreakpoint` re-enables the breakpoint. Again, using the **PassThru** parameter we see that
101+
the value of the **Enabled** property is **True**.
93102

94-
The second command uses the Disable-PSBreakpoint cmdlet to disable the new breakpoint.
95-
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.
96-
This lets you verify that the value of the Enabled property of the breakpoint object is False.
103+
### Example 4: Enable breakpoints using a variable
97104

98-
The third command uses the Enable-PSBreakpoint cmdlet to re-enable the breakpoint.
99-
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.
100-
This lets you verify that the value of the Enabled property of the breakpoint object is True.
101-
102-
The results are shown in the following sample output.
103-
104-
### Example 4
105+
This example enables a set of breakpoints using the breakpoint objects.
105106

106107
```powershell
107-
$b = Get-PSBreakpoint -Id 3, 5
108-
Enable-PSBreakpoint -Breakpoint $b
108+
$B = Get-PSBreakpoint -Id 3, 5
109+
Enable-PSBreakpoint -Breakpoint $B
109110
```
110111

111-
These commands enable a set of breakpoints by specifying their breakpoint objects.
112-
113-
The first command uses the Get-PSBreakpoint cmdlet to get the breakpoints and saves them in the $b variable.
112+
`Get-PSBreakpoint` gets the breakpoints and saves them in the `$B` variable. Using the
113+
**Breakpoint** parameter, `Enable-PSBreakpoint` enables the breakpoints.
114114

115-
The second command uses the Enable-PSBreakpoint cmdlet and its Breakpoint parameter to enable the breakpoints.
116-
117-
This command is the equivalent of "enable-psbreakpoint -id 3, 5".
115+
This example is equivalent to running `Enable-PSBreakpoint -Id 3, 5`.
118116

119117
## PARAMETERS
120118

121119
### -Breakpoint
122120

123-
Specifies the breakpoints to enable.
124-
Enter a variable that contains breakpoint objects or a command that gets breakpoint objects, such as a Get-PSBreakpoint command.
125-
You can also pipe breakpoint objects to Enable-PSBreakpoint.
121+
Specifies the breakpoints to enable. Provide a variable containing breakpoints or a command that
122+
gets breakpoint objects, such as `Get-PSBreakpoint`. You can also pipe breakpoint objects to
123+
`Enable-PSBreakpoint`.
126124

127125
```yaml
128126
Type: Breakpoint[]
129127
Parameter Sets: Breakpoint
130128
Aliases:
131129

132130
Required: True
133-
Position: 1
134-
Default value: None.
131+
Position: 0
132+
Default value: None
135133
Accept pipeline input: True (ByValue)
136134
Accept wildcard characters: False
137135
```
138136
139137
### -Id
140138
141-
Enables breakpoints that have the specified breakpoint IDs.
142-
The default value is all breakpoints.
143-
Enter the IDs or a variable that contains the IDs.
144-
(You cannot pipe IDs to Enable-PSBreakpoint.) To find the ID of a breakpoint, use the Get-PSBreakpoint cmdlet.
139+
Specifies the **Id** numbers of the breakpoints to enable. The default value is all breakpoints.
140+
Provide the **Id** by number or in a variable. You can't pipe **Id** numbers to
141+
`Enable-PSBreakpoint`. To find the **Id** of a breakpoint, use the `Get-PSBreakpoint` cmdlet.
145142

146143
```yaml
147144
Type: Int32[]
148145
Parameter Sets: Id
149146
Aliases:
150147
151148
Required: True
152-
Position: 1
153-
Default value: All breakpoints
149+
Position: 0
150+
Default value: None
154151
Accept pipeline input: True (ByPropertyName)
155152
Accept wildcard characters: False
156153
```
157154

158155
### -PassThru
159156

160-
Returns an object representing the enabled breakpoint.
161-
By default, this cmdlet does not generate any output.
157+
Returns an object representing the breakpoint being enabled. By default, this cmdlet doesn't
158+
generate any output.
162159

163160
```yaml
164161
Type: SwitchParameter
@@ -167,7 +164,7 @@ Aliases:
167164
168165
Required: False
169166
Position: Named
170-
Default value: False
167+
Default value: None
171168
Accept pipeline input: False
172169
Accept wildcard characters: False
173170
```
@@ -183,15 +180,14 @@ Aliases: cf
183180
184181
Required: False
185182
Position: Named
186-
Default value: None
183+
Default value: False
187184
Accept pipeline input: False
188185
Accept wildcard characters: False
189186
```
190187

191188
### -WhatIf
192189

193-
Shows what would happen if the cmdlet runs.
194-
The cmdlet is not run.
190+
Shows what would happen if the cmdlet runs. The cmdlet isn't run.
195191

196192
```yaml
197193
Type: SwitchParameter
@@ -200,34 +196,37 @@ Aliases: wi
200196
201197
Required: False
202198
Position: Named
203-
Default value: None
199+
Default value: False
204200
Accept pipeline input: False
205201
Accept wildcard characters: False
206202
```
207203

208204
### CommonParameters
209205

210-
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).
206+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
207+
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
208+
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
211209

212210
## INPUTS
213211

214212
### System.Management.Automation.Breakpoint
215213

216-
You can pipe a breakpoint object to Enable-PSBreakpoint.
214+
You can pipe a breakpoint object to `Enable-PSBreakpoint`.
217215

218216
## OUTPUTS
219217

220218
### None or System.Management.Automation.Breakpoint
221219

222-
When you use the PassThru parameter, Enable-PSBreakpoint returns a breakpoint object that represent that breakpoint that was enabled.
223-
Otherwise, this cmdlet does not generate any output.
220+
When you use the **PassThru** parameter, `Enable-PSBreakpoint` returns a breakpoint object that represents that breakpoint that was enabled. Otherwise, this cmdlet doesn't generate any output.
224221

225222
## NOTES
226223

227-
- 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.
224+
- The `Enable-PSBreakpoint` cmdlet doesn't generate an error if you try to enable a breakpoint that
225+
is already enabled. As such, you can enable all breakpoints without error, even when only a few
226+
are disabled.
228227

229-
Breakpoints are enabled when you create them by using the Set-PSBreakpoint cmdlet.
230-
You do not need to enable newly created breakpoints.
228+
- Breakpoints are enabled when you create them by using the `Set-PSBreakpoint` cmdlet. You don't
229+
need to enable newly created breakpoints.
231230

232231
## RELATED LINKS
233232

@@ -240,7 +239,3 @@ You do not need to enable newly created breakpoints.
240239
[Remove-PSBreakpoint](Remove-PSBreakpoint.md)
241240

242241
[Set-PSBreakpoint](Set-PSBreakpoint.md)
243-
244-
[about_Debuggers](../Microsoft.PowerShell.Core/About/about_Debuggers.md)
245-
246-

0 commit comments

Comments
 (0)