Skip to content

Commit 3456d77

Browse files
MeterelsdwheelerCopilot
authored
Note Stop-Process as asynchronous (#13205)
* Note Stop-Process as asynchronous Note Stop-Process as asynchronous as it's based on Process.Kill * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Add copilot feedback --------- Co-authored-by: Sean Wheeler <sean.wheeler@microsoft.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 0e55d83 commit 3456d77

5 files changed

Lines changed: 80 additions & 20 deletions

File tree

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

Lines changed: 16 additions & 4 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: 01/05/2023
5+
ms.date: 08/09/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/stop-process?view=powershell-5.1&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -227,7 +227,8 @@ Accept wildcard characters: True
227227

228228
### -PassThru
229229

230-
Returns an object that represents the process. By default, this cmdlet does not generate any output.
230+
By default, this cmdlet doesn't generate any output. When you use this parameter the command returns
231+
an object that represents the process.
231232

232233
```yaml
233234
Type: System.Management.Automation.SwitchParameter
@@ -304,12 +305,23 @@ Windows PowerShell includes the following aliases for `Stop-Process`:
304305
- `kill`
305306
- `spps`
306307

308+
The `Stop-Process` cmdlet doesn't wait for the process to exit. There are two ways to wait for the
309+
process to exit:
310+
311+
- Use the **PassThru** parameter with `Stop-Process` and periodically check the **HasExited**
312+
property of returned **Process** object
313+
- Call `Wait-Process` for the process you stopped to wait for the process to exit
314+
307315
You can also use the properties and methods of the Windows Management Instrumentation (WMI)
308316
**Win32_Process** object in Windows PowerShell. For more information, see `Get-CimInstance` and
309317
the WMI SDK.
310318

311-
- When stopping processes, realize that stopping a process can stop process and services that depend
312-
on the process. In an extreme case, stopping a process can stop Windows.
319+
When stopping processes, realize that stopping a process can stop process and services that depend
320+
on the process. In an extreme case, stopping a process can stop Windows.
321+
322+
This cmdlet is implemented using the **Kill** method of the **System.Diagnostics.Process** class.
323+
For more information about this method, see
324+
[Process.Kill Method](/dotnet/api/system.diagnostics.process.kill).
313325

314326
## RELATED LINKS
315327

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

Lines changed: 16 additions & 4 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: 01/05/2023
5+
ms.date: 08/09/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/stop-process?view=powershell-7.4&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -227,7 +227,8 @@ Accept wildcard characters: True
227227

228228
### -PassThru
229229

230-
Returns an object that represents the process. By default, this cmdlet does not generate any output.
230+
By default, this cmdlet doesn't generate any output. When you use this parameter the command returns
231+
an object that represents the process.
231232

232233
```yaml
233234
Type: System.Management.Automation.SwitchParameter
@@ -306,12 +307,23 @@ PowerShell includes the following aliases for `Stop-Process`:
306307
- Windows:
307308
- `kill`
308309

310+
The `Stop-Process` cmdlet doesn't wait for the process to exit. There are two ways to wait for the
311+
process to exit:
312+
313+
- Use the **PassThru** parameter with `Stop-Process` and periodically check the **HasExited**
314+
property of returned **Process** object
315+
- Call `Wait-Process` for the process you stopped to wait for the process to exit
316+
309317
You can also use the properties and methods of the Windows Management Instrumentation (WMI)
310318
**Win32_Process** object in Windows PowerShell. For more information, see `Get-CimInstance` and
311319
the WMI SDK.
312320

313-
- When stopping processes, realize that stopping a process can stop process and services that depend
314-
on the process. In an extreme case, stopping a process can stop Windows.
321+
When stopping processes, realize that stopping a process can stop process and services that depend
322+
on the process. In an extreme case, stopping a process can stop Windows.
323+
324+
This cmdlet is implemented using the **Kill** method of the **System.Diagnostics.Process** class.
325+
For more information about this method, see
326+
[Process.Kill Method](/dotnet/api/system.diagnostics.process.kill).
315327

316328
## RELATED LINKS
317329

reference/7.5/Microsoft.PowerShell.Management/Stop-Process.md

Lines changed: 16 additions & 4 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: 01/05/2023
5+
ms.date: 08/09/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/stop-process?view=powershell-7.5&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -226,7 +226,8 @@ Accept wildcard characters: True
226226

227227
### -PassThru
228228

229-
Returns an object that represents the process. By default, this cmdlet does not generate any output.
229+
By default, this cmdlet doesn't generate any output. When you use this parameter the command returns
230+
an object that represents the process.
230231

231232
```yaml
232233
Type: System.Management.Automation.SwitchParameter
@@ -305,12 +306,23 @@ PowerShell includes the following aliases for `Stop-Process`:
305306
- Windows:
306307
- `kill`
307308

309+
The `Stop-Process` cmdlet doesn't wait for the process to exit. There are two ways to wait for the
310+
process to exit:
311+
312+
- Use the **PassThru** parameter with `Stop-Process` and periodically check the **HasExited**
313+
property of returned **Process** object
314+
- Call `Wait-Process` for the process you stopped to wait for the process to exit
315+
308316
You can also use the properties and methods of the Windows Management Instrumentation (WMI)
309317
**Win32_Process** object in Windows PowerShell. For more information, see `Get-CimInstance` and
310318
the WMI SDK.
311319

312-
- When stopping processes, realize that stopping a process can stop process and services that depend
313-
on the process. In an extreme case, stopping a process can stop Windows.
320+
When stopping processes, realize that stopping a process can stop process and services that depend
321+
on the process. In an extreme case, stopping a process can stop Windows.
322+
323+
This cmdlet is implemented using the **Kill** method of the **System.Diagnostics.Process** class.
324+
For more information about this method, see
325+
[Process.Kill Method](/dotnet/api/system.diagnostics.process.kill).
314326

315327
## RELATED LINKS
316328

reference/7.6/Microsoft.PowerShell.Management/Stop-Process.md

Lines changed: 16 additions & 4 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: 01/05/2023
5+
ms.date: 08/09/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/stop-process?view=powershell-7.6&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -226,7 +226,8 @@ Accept wildcard characters: True
226226

227227
### -PassThru
228228

229-
Returns an object that represents the process. By default, this cmdlet does not generate any output.
229+
By default, this cmdlet doesn't generate any output. When you use this parameter the command returns
230+
an object that represents the process.
230231

231232
```yaml
232233
Type: System.Management.Automation.SwitchParameter
@@ -305,12 +306,23 @@ PowerShell includes the following aliases for `Stop-Process`:
305306
- Windows:
306307
- `kill`
307308

309+
The `Stop-Process` cmdlet doesn't wait for the process to exit. There are two ways to wait for the
310+
process to exit:
311+
312+
- Use the **PassThru** parameter with `Stop-Process` and periodically check the **HasExited**
313+
property of returned **Process** object
314+
- Call `Wait-Process` for the process you stopped to wait for the process to exit
315+
308316
You can also use the properties and methods of the Windows Management Instrumentation (WMI)
309317
**Win32_Process** object in Windows PowerShell. For more information, see `Get-CimInstance` and
310318
the WMI SDK.
311319

312-
- When stopping processes, realize that stopping a process can stop process and services that depend
313-
on the process. In an extreme case, stopping a process can stop Windows.
320+
When stopping processes, realize that stopping a process can stop process and services that depend
321+
on the process. In an extreme case, stopping a process can stop Windows.
322+
323+
This cmdlet is implemented using the **Kill** method of the **System.Diagnostics.Process** class.
324+
For more information about this method, see
325+
[Process.Kill Method](/dotnet/api/system.diagnostics.process.kill).
314326

315327
## RELATED LINKS
316328

reference/7.7/Microsoft.PowerShell.Management/Stop-Process.md

Lines changed: 16 additions & 4 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: 01/05/2023
5+
ms.date: 08/09/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/stop-process?view=powershell-7.7&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -226,7 +226,8 @@ Accept wildcard characters: True
226226

227227
### -PassThru
228228

229-
Returns an object that represents the process. By default, this cmdlet does not generate any output.
229+
By default, this cmdlet doesn't generate any output. When you use this parameter the command returns
230+
an object that represents the process.
230231

231232
```yaml
232233
Type: System.Management.Automation.SwitchParameter
@@ -305,12 +306,23 @@ PowerShell includes the following aliases for `Stop-Process`:
305306
- Windows:
306307
- `kill`
307308

309+
The `Stop-Process` cmdlet doesn't wait for the process to exit. There are two ways to wait for the
310+
process to exit:
311+
312+
- Use the **PassThru** parameter with `Stop-Process` and periodically check the **HasExited**
313+
property of returned **Process** object
314+
- Call `Wait-Process` for the process you stopped to wait for the process to exit
315+
308316
You can also use the properties and methods of the Windows Management Instrumentation (WMI)
309317
**Win32_Process** object in Windows PowerShell. For more information, see `Get-CimInstance` and
310318
the WMI SDK.
311319

312-
- When stopping processes, realize that stopping a process can stop process and services that depend
313-
on the process. In an extreme case, stopping a process can stop Windows.
320+
When stopping processes, realize that stopping a process can stop process and services that depend
321+
on the process. In an extreme case, stopping a process can stop Windows.
322+
323+
This cmdlet is implemented using the **Kill** method of the **System.Diagnostics.Process** class.
324+
For more information about this method, see
325+
[Process.Kill Method](/dotnet/api/system.diagnostics.process.kill).
314326

315327
## RELATED LINKS
316328

0 commit comments

Comments
 (0)