PowerShell Logo Small

Debug-Process



This is the built-in help made by Microsoft for the command 'Debug-Process', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Debugs one or more processes running on the local computer.

SYNTAX


Debug-Process [-Name] <string[]> [-Confirm] [-WhatIf] [<CommonParameters>]
Debug-Process [-Id] <Int32[]> [-Confirm] [-WhatIf] [<CommonParameters>]
Debug-Process -InputObject <Process[]> [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Debug-Process cmdlet attaches a debugger to one or more running processes on a local computer. You can specify the processes by their process
name or process ID (PID), or you can pipe process objects to Debug-Process.

Debug-Process attaches the debugger that is currently registered for the process. Before using this cmdlet, verify that a debugger is downloaded
and correctly configured.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=135206
Get-Process
Start-Process
Stop-Process
Wait-Process
Debug-Process

REMARKS

<

Examples


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

C:\PS>debug-process -name powershell



Description
-----------
This command attaches a debugger to the PowerShell process on the computer.








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

C:\PS>debug-process -name sql*



Description
-----------
This command attaches a debugger to all processes that have names that begin with "sql".








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

C:\PS>debug-process winlogon, explorer, outlook



Description
-----------
This command attaches a debugger to the Winlogon, Explorer, and Outlook processes.








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

C:\PS>debug-process -id 1132, 2028



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








-------------------------- EXAMPLE 5 --------------------------

C:\PS>get-process powershell | debug-process



Description
-----------
This command attaches a debugger to the PowerShell processes on the computer. It uses the Get-Process cmdlet to get the PowerShell processes on t
he computer, and it uses a pipeline operator (|) to send the processes to the Debug-Process cmdlet.

To specify a particular PowerShell process, use the ID parameter of Get-Process.








-------------------------- EXAMPLE 6 --------------------------

C:\PS>$pid | debug-process



Description
-----------
This command attaches a debugger to the current PowerShell processes on the computer.

It uses the $pid automatic variable, which contains the process ID of the current PowerShell process. Then, it uses a pipeline operator (|) to se
nd the process ID to the Debug-Process cmdlet.

For more information about the $pid automatic variable, see about_Automatic_Variables.








-------------------------- EXAMPLE 7 --------------------------

C:\PS>get-process -computername Server01, Server02 -name MyApp | debug-process



Description
-----------
This command attaches a debugger to the MyApp processes on the Server01 and Server02 computers.

It uses the Get-Process cmdlet to get the MyApp processes on the Server01 and Server02 computers. It uses a pipeline operator to send the process
es to the Debug-Process cmdlet, which attaches the debuggers.








-------------------------- EXAMPLE 8 --------------------------

C:\PS>$p = get-process powershell

C:\PS> debug-process -inputobject $p



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

The first command uses the Get-Process cmdlet to get the PowerShell processes on the computer. It saves the resulting process object in the $p va
riable.

The second command uses the InputObject parameter of Debug-Process to submit the process object in the $p variable to Debug-Process.