Skip to content

Commit d44bd43

Browse files
authored
Fix examples for Debug-Process (#11297)
1 parent b2f7283 commit d44bd43

File tree

4 files changed

+94
-86
lines changed

4 files changed

+94
-86
lines changed

reference/5.1/Microsoft.PowerShell.Management/Debug-Process.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Management
5-
ms.date: 12/12/2022
5+
ms.date: 07/24/2024
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/debug-process?view=powershell-5.1&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
title: Debug-Process
@@ -39,47 +39,48 @@ The `Debug-Process` cmdlet attaches a debugger to one or more running processes
3939
You can specify the processes by their process name or process ID (PID), or you can pipe process
4040
objects to this cmdlet.
4141

42-
This cmdlet attaches the debugger that is currently registered for the process. Before using this
43-
cmdlet, verify that a debugger is downloaded and correctly configured.
42+
This cmdlet attaches the debugger that's registered for the process. Before using this cmdlet,
43+
verify that a debugger is installed and configured.
4444

4545
## EXAMPLES
4646

4747
### Example 1: Attach a debugger to a process on the computer
4848

49-
```
50-
PS C:\> Debug-Process -Name "Windows Powershell"
49+
```powershell
50+
Debug-Process -Name Powershell
5151
```
5252

5353
This command attaches a debugger to the PowerShell process on the computer.
5454

5555
### Example 2: Attach a debugger to all processes that begin with the specified string
5656

57-
```
58-
PS C:\> Debug-Process -Name "SQL*"
57+
```powershell
58+
Debug-Process -Name note*
5959
```
6060

61-
This command attaches a debugger to all processes that have names that begin with SQL.
61+
This command attaches a debugger to all processes that have names that begin with `note`.
6262

6363
### Example 3: Attach a debugger to multiple processes
6464

65-
```
66-
PS C:\> Debug-Process "Winlogon", "Explorer", "Outlook"
65+
```powershell
66+
Debug-Process "Winlogon", "Explorer", "Outlook"
6767
```
6868

69-
This command attaches a debugger to the Winlogon, Explorer, and Outlook processes.
69+
This command attempts to attach a debugger to the Winlogon, Explorer, and Outlook processes.
70+
Winlogon is a protected process. To debug Winlogon, you must run the command as an administrator.
7071

7172
### Example 4: Attach a debugger to multiple process IDs
7273

73-
```
74-
PS C:\> Debug-Process -Id 1132, 2028
74+
```powershell
75+
Debug-Process -Id 1132, 2028
7576
```
7677

7778
This command attaches a debugger to the processes that have process IDs 1132 and 2028.
7879

7980
### Example 5: Use Get-Process to get a process then attach a debugger to it
8081

81-
```
82-
PS C:\> Get-Process "Windows PowerShell" | Debug-Process
82+
```powershell
83+
Get-Process PowerShell | Debug-Process
8384
```
8485

8586
This command attaches a debugger to the PowerShell processes on the computer. It uses the
@@ -90,8 +91,8 @@ To specify a particular PowerShell process, use the ID parameter of `Get-Process
9091

9192
### Example 6: Attach a debugger to a current process on the local computer
9293

93-
```
94-
PS C:\> $PID | Debug-Process
94+
```powershell
95+
Debug-Process -Id $PID
9596
```
9697

9798
This command attaches a debugger to the current PowerShell processes on the computer.
@@ -100,12 +101,13 @@ The command uses the `$PID` automatic variable, which contains the process ID of
100101
PowerShell process. Then, it uses a pipeline operator (`|`) to send the process ID to the
101102
`Debug-Process` cmdlet.
102103

103-
For more information about the `$PID` automatic variable, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md).
104+
For more information about the `$PID` automatic variable, see
105+
[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md).
104106

105107
### Example 7: Attach a debugger to the specified process on multiple computers
106108

107-
```
108-
PS C:\> Get-Process -ComputerName "Server01", "Server02" -Name "MyApp" | Debug-Process
109+
```powershell
110+
Get-Process -ComputerName "Server01", "Server02" -Name "MyApp" | Debug-Process
109111
```
110112

111113
This command attaches a debugger to the MyApp processes on the Server01 and Server02 computers.
@@ -116,9 +118,9 @@ attaches the debuggers.
116118

117119
### Example 8: Attach a debugger to a process that uses the InputObject parameter
118120

119-
```
120-
PS C:\> $P = Get-Process "Windows PowerShell"
121-
PS C:\> Debug-Process -InputObject $P
121+
```powershell
122+
$P = Get-Process PowerShell
123+
Debug-Process -InputObject $P
122124
```
123125

124126
This command attaches a debugger to the PowerShell processes on the local computer.

reference/7.2/Microsoft.PowerShell.Management/Debug-Process.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Management
5-
ms.date: 12/12/2022
5+
ms.date: 07/24/2024
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/debug-process?view=powershell-7.2&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
title: Debug-Process
@@ -39,47 +39,48 @@ The `Debug-Process` cmdlet attaches a debugger to one or more running processes
3939
You can specify the processes by their process name or process ID (PID), or you can pipe process
4040
objects to this cmdlet.
4141

42-
This cmdlet attaches the debugger that is currently registered for the process. Before using this
43-
cmdlet, verify that a debugger is downloaded and correctly configured.
42+
This cmdlet attaches the debugger that's registered for the process. Before using this cmdlet,
43+
verify that a debugger is installed and configured.
4444

4545
## EXAMPLES
4646

4747
### Example 1: Attach a debugger to a process on the computer
4848

49-
```
50-
PS C:\> Debug-Process -Name "Windows Powershell"
49+
```powershell
50+
Debug-Process -Name Powershell
5151
```
5252

5353
This command attaches a debugger to the PowerShell process on the computer.
5454

5555
### Example 2: Attach a debugger to all processes that begin with the specified string
5656

57-
```
58-
PS C:\> Debug-Process -Name "SQL*"
57+
```powershell
58+
Debug-Process -Name note*
5959
```
6060

61-
This command attaches a debugger to all processes that have names that begin with SQL.
61+
This command attaches a debugger to all processes that have names that begin with `note`.
6262

6363
### Example 3: Attach a debugger to multiple processes
6464

65-
```
66-
PS C:\> Debug-Process "Winlogon", "Explorer", "Outlook"
65+
```powershell
66+
Debug-Process "Winlogon", "Explorer", "Outlook"
6767
```
6868

69-
This command attaches a debugger to the Winlogon, Explorer, and Outlook processes.
69+
This command attempts to attach a debugger to the Winlogon, Explorer, and Outlook processes.
70+
Winlogon is a protected process. To debug Winlogon, you must run the command as an administrator.
7071

7172
### Example 4: Attach a debugger to multiple process IDs
7273

73-
```
74-
PS C:\> Debug-Process -Id 1132, 2028
74+
```powershell
75+
Debug-Process -Id 1132, 2028
7576
```
7677

7778
This command attaches a debugger to the processes that have process IDs 1132 and 2028.
7879

7980
### Example 5: Use Get-Process to get a process then attach a debugger to it
8081

81-
```
82-
PS C:\> Get-Process "Windows PowerShell" | Debug-Process
82+
```powershell
83+
Get-Process PowerShell | Debug-Process
8384
```
8485

8586
This command attaches a debugger to the PowerShell processes on the computer. It uses the
@@ -90,8 +91,8 @@ To specify a particular PowerShell process, use the ID parameter of `Get-Process
9091

9192
### Example 6: Attach a debugger to a current process on the local computer
9293

93-
```
94-
PS C:\> $PID | Debug-Process
94+
```powershell
95+
Debug-Process -Id $PID
9596
```
9697

9798
This command attaches a debugger to the current PowerShell processes on the computer.
@@ -100,13 +101,14 @@ The command uses the `$PID` automatic variable, which contains the process ID of
100101
PowerShell process. Then, it uses a pipeline operator (`|`) to send the process ID to the
101102
`Debug-Process` cmdlet.
102103

103-
For more information about the `$PID` automatic variable, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md).
104+
For more information about the `$PID` automatic variable, see
105+
[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md).
104106

105107
### Example 7: Attach a debugger to a process that uses the InputObject parameter
106108

107-
```
108-
PS C:\> $P = Get-Process "Windows PowerShell"
109-
PS C:\> Debug-Process -InputObject $P
109+
```powershell
110+
$P = Get-Process PowerShell
111+
Debug-Process -InputObject $P
110112
```
111113

112114
This command attaches a debugger to the PowerShell processes on the local computer.

reference/7.4/Microsoft.PowerShell.Management/Debug-Process.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Management
5-
ms.date: 12/12/2022
5+
ms.date: 07/24/2024
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/debug-process?view=powershell-7.4&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
title: Debug-Process
@@ -39,47 +39,48 @@ The `Debug-Process` cmdlet attaches a debugger to one or more running processes
3939
You can specify the processes by their process name or process ID (PID), or you can pipe process
4040
objects to this cmdlet.
4141

42-
This cmdlet attaches the debugger that is currently registered for the process. Before using this
43-
cmdlet, verify that a debugger is downloaded and correctly configured.
42+
This cmdlet attaches the debugger that's registered for the process. Before using this cmdlet,
43+
verify that a debugger is installed and configured.
4444

4545
## EXAMPLES
4646

4747
### Example 1: Attach a debugger to a process on the computer
4848

49-
```
50-
PS C:\> Debug-Process -Name "Windows Powershell"
49+
```powershell
50+
Debug-Process -Name Powershell
5151
```
5252

5353
This command attaches a debugger to the PowerShell process on the computer.
5454

5555
### Example 2: Attach a debugger to all processes that begin with the specified string
5656

57-
```
58-
PS C:\> Debug-Process -Name "SQL*"
57+
```powershell
58+
Debug-Process -Name note*
5959
```
6060

61-
This command attaches a debugger to all processes that have names that begin with SQL.
61+
This command attaches a debugger to all processes that have names that begin with `note`.
6262

6363
### Example 3: Attach a debugger to multiple processes
6464

65-
```
66-
PS C:\> Debug-Process "Winlogon", "Explorer", "Outlook"
65+
```powershell
66+
Debug-Process "Winlogon", "Explorer", "Outlook"
6767
```
6868

69-
This command attaches a debugger to the Winlogon, Explorer, and Outlook processes.
69+
This command attempts to attach a debugger to the Winlogon, Explorer, and Outlook processes.
70+
Winlogon is a protected process. To debug Winlogon, you must run the command as an administrator.
7071

7172
### Example 4: Attach a debugger to multiple process IDs
7273

73-
```
74-
PS C:\> Debug-Process -Id 1132, 2028
74+
```powershell
75+
Debug-Process -Id 1132, 2028
7576
```
7677

7778
This command attaches a debugger to the processes that have process IDs 1132 and 2028.
7879

7980
### Example 5: Use Get-Process to get a process then attach a debugger to it
8081

81-
```
82-
PS C:\> Get-Process "Windows PowerShell" | Debug-Process
82+
```powershell
83+
Get-Process PowerShell | Debug-Process
8384
```
8485

8586
This command attaches a debugger to the PowerShell processes on the computer. It uses the
@@ -90,8 +91,8 @@ To specify a particular PowerShell process, use the ID parameter of `Get-Process
9091

9192
### Example 6: Attach a debugger to a current process on the local computer
9293

93-
```
94-
PS C:\> $PID | Debug-Process
94+
```powershell
95+
Debug-Process -Id $PID
9596
```
9697

9798
This command attaches a debugger to the current PowerShell processes on the computer.
@@ -100,13 +101,14 @@ The command uses the `$PID` automatic variable, which contains the process ID of
100101
PowerShell process. Then, it uses a pipeline operator (`|`) to send the process ID to the
101102
`Debug-Process` cmdlet.
102103

103-
For more information about the `$PID` automatic variable, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md).
104+
For more information about the `$PID` automatic variable, see
105+
[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md).
104106

105107
### Example 7: Attach a debugger to a process that uses the InputObject parameter
106108

107-
```
108-
PS C:\> $P = Get-Process "Windows PowerShell"
109-
PS C:\> Debug-Process -InputObject $P
109+
```powershell
110+
$P = Get-Process PowerShell
111+
Debug-Process -InputObject $P
110112
```
111113

112114
This command attaches a debugger to the PowerShell processes on the local computer.

0 commit comments

Comments
 (0)