From 22674eedb631e5d9a6808918023f0f49b232fb70 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Wed, 24 Jul 2024 13:20:07 -0500 Subject: [PATCH] Fix examples for Debug-Process --- .../Debug-Process.md | 48 ++++++++++--------- .../Debug-Process.md | 44 +++++++++-------- .../Debug-Process.md | 44 +++++++++-------- .../Debug-Process.md | 44 +++++++++-------- 4 files changed, 94 insertions(+), 86 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Management/Debug-Process.md b/reference/5.1/Microsoft.PowerShell.Management/Debug-Process.md index 4eb318aa947e..7689141fb866 100644 --- a/reference/5.1/Microsoft.PowerShell.Management/Debug-Process.md +++ b/reference/5.1/Microsoft.PowerShell.Management/Debug-Process.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 12/12/2022 +ms.date: 07/24/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/debug-process?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: Debug-Process @@ -39,47 +39,48 @@ The `Debug-Process` cmdlet attaches a debugger to one or more running processes You can specify the processes by their process name or process ID (PID), or you can pipe process objects to this cmdlet. -This cmdlet attaches the debugger that is currently registered for the process. Before using this -cmdlet, verify that a debugger is downloaded and correctly configured. +This cmdlet attaches the debugger that's registered for the process. Before using this cmdlet, +verify that a debugger is installed and configured. ## EXAMPLES ### Example 1: Attach a debugger to a process on the computer -``` -PS C:\> Debug-Process -Name "Windows Powershell" +```powershell +Debug-Process -Name Powershell ``` This command attaches a debugger to the PowerShell process on the computer. ### Example 2: Attach a debugger to all processes that begin with the specified string -``` -PS C:\> Debug-Process -Name "SQL*" +```powershell +Debug-Process -Name note* ``` -This command attaches a debugger to all processes that have names that begin with SQL. +This command attaches a debugger to all processes that have names that begin with `note`. ### Example 3: Attach a debugger to multiple processes -``` -PS C:\> Debug-Process "Winlogon", "Explorer", "Outlook" +```powershell +Debug-Process "Winlogon", "Explorer", "Outlook" ``` -This command attaches a debugger to the Winlogon, Explorer, and Outlook processes. +This command attempts to attach a debugger to the Winlogon, Explorer, and Outlook processes. +Winlogon is a protected process. To debug Winlogon, you must run the command as an administrator. ### Example 4: Attach a debugger to multiple process IDs -``` -PS C:\> Debug-Process -Id 1132, 2028 +```powershell +Debug-Process -Id 1132, 2028 ``` This command attaches a debugger to the processes that have process IDs 1132 and 2028. ### Example 5: Use Get-Process to get a process then attach a debugger to it -``` -PS C:\> Get-Process "Windows PowerShell" | Debug-Process +```powershell +Get-Process PowerShell | Debug-Process ``` 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 ### Example 6: Attach a debugger to a current process on the local computer -``` -PS C:\> $PID | Debug-Process +```powershell + Debug-Process -Id $PID ``` 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 PowerShell process. Then, it uses a pipeline operator (`|`) to send the process ID to the `Debug-Process` cmdlet. -For more information about the `$PID` automatic variable, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). +For more information about the `$PID` automatic variable, see +[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). ### Example 7: Attach a debugger to the specified process on multiple computers -``` -PS C:\> Get-Process -ComputerName "Server01", "Server02" -Name "MyApp" | Debug-Process +```powershell +Get-Process -ComputerName "Server01", "Server02" -Name "MyApp" | Debug-Process ``` This command attaches a debugger to the MyApp processes on the Server01 and Server02 computers. @@ -116,9 +118,9 @@ attaches the debuggers. ### Example 8: Attach a debugger to a process that uses the InputObject parameter -``` -PS C:\> $P = Get-Process "Windows PowerShell" -PS C:\> Debug-Process -InputObject $P +```powershell +$P = Get-Process PowerShell +Debug-Process -InputObject $P ``` This command attaches a debugger to the PowerShell processes on the local computer. diff --git a/reference/7.2/Microsoft.PowerShell.Management/Debug-Process.md b/reference/7.2/Microsoft.PowerShell.Management/Debug-Process.md index 6381d52a5034..8fda9747b2aa 100644 --- a/reference/7.2/Microsoft.PowerShell.Management/Debug-Process.md +++ b/reference/7.2/Microsoft.PowerShell.Management/Debug-Process.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 12/12/2022 +ms.date: 07/24/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/debug-process?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: Debug-Process @@ -39,47 +39,48 @@ The `Debug-Process` cmdlet attaches a debugger to one or more running processes You can specify the processes by their process name or process ID (PID), or you can pipe process objects to this cmdlet. -This cmdlet attaches the debugger that is currently registered for the process. Before using this -cmdlet, verify that a debugger is downloaded and correctly configured. +This cmdlet attaches the debugger that's registered for the process. Before using this cmdlet, +verify that a debugger is installed and configured. ## EXAMPLES ### Example 1: Attach a debugger to a process on the computer -``` -PS C:\> Debug-Process -Name "Windows Powershell" +```powershell +Debug-Process -Name Powershell ``` This command attaches a debugger to the PowerShell process on the computer. ### Example 2: Attach a debugger to all processes that begin with the specified string -``` -PS C:\> Debug-Process -Name "SQL*" +```powershell +Debug-Process -Name note* ``` -This command attaches a debugger to all processes that have names that begin with SQL. +This command attaches a debugger to all processes that have names that begin with `note`. ### Example 3: Attach a debugger to multiple processes -``` -PS C:\> Debug-Process "Winlogon", "Explorer", "Outlook" +```powershell +Debug-Process "Winlogon", "Explorer", "Outlook" ``` -This command attaches a debugger to the Winlogon, Explorer, and Outlook processes. +This command attempts to attach a debugger to the Winlogon, Explorer, and Outlook processes. +Winlogon is a protected process. To debug Winlogon, you must run the command as an administrator. ### Example 4: Attach a debugger to multiple process IDs -``` -PS C:\> Debug-Process -Id 1132, 2028 +```powershell +Debug-Process -Id 1132, 2028 ``` This command attaches a debugger to the processes that have process IDs 1132 and 2028. ### Example 5: Use Get-Process to get a process then attach a debugger to it -``` -PS C:\> Get-Process "Windows PowerShell" | Debug-Process +```powershell +Get-Process PowerShell | Debug-Process ``` 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 ### Example 6: Attach a debugger to a current process on the local computer -``` -PS C:\> $PID | Debug-Process +```powershell + Debug-Process -Id $PID ``` 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 PowerShell process. Then, it uses a pipeline operator (`|`) to send the process ID to the `Debug-Process` cmdlet. -For more information about the `$PID` automatic variable, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). +For more information about the `$PID` automatic variable, see +[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). ### Example 7: Attach a debugger to a process that uses the InputObject parameter -``` -PS C:\> $P = Get-Process "Windows PowerShell" -PS C:\> Debug-Process -InputObject $P +```powershell +$P = Get-Process PowerShell +Debug-Process -InputObject $P ``` This command attaches a debugger to the PowerShell processes on the local computer. diff --git a/reference/7.4/Microsoft.PowerShell.Management/Debug-Process.md b/reference/7.4/Microsoft.PowerShell.Management/Debug-Process.md index 8a380c69ea78..b55431d4e7b0 100644 --- a/reference/7.4/Microsoft.PowerShell.Management/Debug-Process.md +++ b/reference/7.4/Microsoft.PowerShell.Management/Debug-Process.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 12/12/2022 +ms.date: 07/24/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/debug-process?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Debug-Process @@ -39,47 +39,48 @@ The `Debug-Process` cmdlet attaches a debugger to one or more running processes You can specify the processes by their process name or process ID (PID), or you can pipe process objects to this cmdlet. -This cmdlet attaches the debugger that is currently registered for the process. Before using this -cmdlet, verify that a debugger is downloaded and correctly configured. +This cmdlet attaches the debugger that's registered for the process. Before using this cmdlet, +verify that a debugger is installed and configured. ## EXAMPLES ### Example 1: Attach a debugger to a process on the computer -``` -PS C:\> Debug-Process -Name "Windows Powershell" +```powershell +Debug-Process -Name Powershell ``` This command attaches a debugger to the PowerShell process on the computer. ### Example 2: Attach a debugger to all processes that begin with the specified string -``` -PS C:\> Debug-Process -Name "SQL*" +```powershell +Debug-Process -Name note* ``` -This command attaches a debugger to all processes that have names that begin with SQL. +This command attaches a debugger to all processes that have names that begin with `note`. ### Example 3: Attach a debugger to multiple processes -``` -PS C:\> Debug-Process "Winlogon", "Explorer", "Outlook" +```powershell +Debug-Process "Winlogon", "Explorer", "Outlook" ``` -This command attaches a debugger to the Winlogon, Explorer, and Outlook processes. +This command attempts to attach a debugger to the Winlogon, Explorer, and Outlook processes. +Winlogon is a protected process. To debug Winlogon, you must run the command as an administrator. ### Example 4: Attach a debugger to multiple process IDs -``` -PS C:\> Debug-Process -Id 1132, 2028 +```powershell +Debug-Process -Id 1132, 2028 ``` This command attaches a debugger to the processes that have process IDs 1132 and 2028. ### Example 5: Use Get-Process to get a process then attach a debugger to it -``` -PS C:\> Get-Process "Windows PowerShell" | Debug-Process +```powershell +Get-Process PowerShell | Debug-Process ``` 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 ### Example 6: Attach a debugger to a current process on the local computer -``` -PS C:\> $PID | Debug-Process +```powershell + Debug-Process -Id $PID ``` 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 PowerShell process. Then, it uses a pipeline operator (`|`) to send the process ID to the `Debug-Process` cmdlet. -For more information about the `$PID` automatic variable, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). +For more information about the `$PID` automatic variable, see +[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). ### Example 7: Attach a debugger to a process that uses the InputObject parameter -``` -PS C:\> $P = Get-Process "Windows PowerShell" -PS C:\> Debug-Process -InputObject $P +```powershell +$P = Get-Process PowerShell +Debug-Process -InputObject $P ``` This command attaches a debugger to the PowerShell processes on the local computer. diff --git a/reference/7.5/Microsoft.PowerShell.Management/Debug-Process.md b/reference/7.5/Microsoft.PowerShell.Management/Debug-Process.md index 7afc5c802a4b..42991a6b44c9 100644 --- a/reference/7.5/Microsoft.PowerShell.Management/Debug-Process.md +++ b/reference/7.5/Microsoft.PowerShell.Management/Debug-Process.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 12/12/2022 +ms.date: 07/24/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/debug-process?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: Debug-Process @@ -39,47 +39,48 @@ The `Debug-Process` cmdlet attaches a debugger to one or more running processes You can specify the processes by their process name or process ID (PID), or you can pipe process objects to this cmdlet. -This cmdlet attaches the debugger that is currently registered for the process. Before using this -cmdlet, verify that a debugger is downloaded and correctly configured. +This cmdlet attaches the debugger that's registered for the process. Before using this cmdlet, +verify that a debugger is installed and configured. ## EXAMPLES ### Example 1: Attach a debugger to a process on the computer -``` -PS C:\> Debug-Process -Name "Windows Powershell" +```powershell +Debug-Process -Name Powershell ``` This command attaches a debugger to the PowerShell process on the computer. ### Example 2: Attach a debugger to all processes that begin with the specified string -``` -PS C:\> Debug-Process -Name "SQL*" +```powershell +Debug-Process -Name note* ``` -This command attaches a debugger to all processes that have names that begin with SQL. +This command attaches a debugger to all processes that have names that begin with `note`. ### Example 3: Attach a debugger to multiple processes -``` -PS C:\> Debug-Process "Winlogon", "Explorer", "Outlook" +```powershell +Debug-Process "Winlogon", "Explorer", "Outlook" ``` -This command attaches a debugger to the Winlogon, Explorer, and Outlook processes. +This command attempts to attach a debugger to the Winlogon, Explorer, and Outlook processes. +Winlogon is a protected process. To debug Winlogon, you must run the command as an administrator. ### Example 4: Attach a debugger to multiple process IDs -``` -PS C:\> Debug-Process -Id 1132, 2028 +```powershell +Debug-Process -Id 1132, 2028 ``` This command attaches a debugger to the processes that have process IDs 1132 and 2028. ### Example 5: Use Get-Process to get a process then attach a debugger to it -``` -PS C:\> Get-Process "Windows PowerShell" | Debug-Process +```powershell +Get-Process PowerShell | Debug-Process ``` 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 ### Example 6: Attach a debugger to a current process on the local computer -``` -PS C:\> $PID | Debug-Process +```powershell + Debug-Process -Id $PID ``` 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 PowerShell process. Then, it uses a pipeline operator (`|`) to send the process ID to the `Debug-Process` cmdlet. -For more information about the `$PID` automatic variable, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). +For more information about the `$PID` automatic variable, see +[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). ### Example 7: Attach a debugger to a process that uses the InputObject parameter -``` -PS C:\> $P = Get-Process "Windows PowerShell" -PS C:\> Debug-Process -InputObject $P +```powershell +$P = Get-Process PowerShell +Debug-Process -InputObject $P ``` This command attaches a debugger to the PowerShell processes on the local computer.