Stop-Process
Use Stop-Process to stop running processes by name or ID; -Force ends processes that ignore a normal stop request.
Documentation: Microsoft Learn — Stop-Process
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Stop-Process [-Id] <Int32[]> [-PassThru] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]- Stage 1Stop-Process
-Id -PassThru -Force -WhatIf -Confirm
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Follow the objects
Run the command to inspect each stage.
Examples
Get-Process -Name notepad
Show reference output
Sample output · fictional data, shaped like the real thing
Get-Process: Cannot find a process with the name "notepad". Verify the process name and call the cmdlet again.
Stop-Process -Id 4242
Show reference output
Sample output · fictional data, shaped like the real thing
Stop-Process: Cannot find a process with the process identifier 4242. Verify the process identifier and call the cmdlet again.
Get-Process -Name notepad (2)
Show reference output
Sample output · fictional data, shaped like the real thing
True
Parameters
Parameter definitions:
-Id-PassThru-Force-WhatIf-Confirm
Practical use and troubleshooting
Practical scenario: Use Stop-Process when you need to stop running processes by name or ID; -Force ends processes that ignore a normal stop request. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: Access denied when terminating another user's process may require elevation. Confirm its current process ID and owner first; a recycled process ID can identify a different application later. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Wait-Process. Stop-Process requests process termination; Wait-Process waits for a process to exit. Waiting does not stop the application and termination is not a graceful application shutdown. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
Stop-Process Use Stop-Process to stop running processes by name or ID; -Force ends processes that ignore a normal stop request.
Next: Get-Process