| by Arround The Web | No comments

How to Use the Stop-Process (Microsoft.PowerShell.Management) Cmdlet in PowerShell?

PowerShell’s “Stop-Process” cmdlet is used to stop one or more running processes. It used a process name, and process ID to stop a process. It operates only on the running processes that are running on a local system. When this cmdlet gets executed, it sends the signal to the process in order to stop it and then terminates it.

In this post, we will demonstrate the “Stop-Process” cmdlet with various illustrations.

How to Use the Stop-Process (Microsoft.PowerShell.Management) Cmdlet in PowerShell?

To use the “Stop-Process” cmdlet in PowerShell to stop or kill a process, first, specify the mentioned cmdlet and then add the process name or ID to stop it. Let’s explore the given examples to learn more about the “Stop-Process” cmdlet.

Example 1: Use the Cmdlet “Stop-Process” to Stop a Process Using its Name
To stop a process, initially, place the “Stop-Process” cmdlet with the “-Name” parameter having the process name assigned to it:

Stop-Process -Name "CalculatorApp"

Example 2: Use the “Stop-Process” Cmdlet to Stop Multiple Processes
To kill or stop multiple processes, simply, assign more than one process to the “-Name” parameter separated by a comma:

Stop-Process -Name "notepad","CalculatorApp"

Example 3: Use the “Stop-Process” Cmdlet to Forcefully Stop a Process
Place the “-Force” parameter at the end of the above-stated command to stop the process forcefully:

Stop-Process -Name "CalculatorApp" -Force

Example 4: Use the “Stop-Process” Cmdlet to Stop a Process by its ID
Specify any process using the “-Id” parameter, assign it the process ID, and stop it:

Stop-Process -Id 12164 -Confirm -PassThru

That’s it! We have explained the “Stop-Process” cmdlet in detail.

Conclusion

The “Stop-Process” cmdlet to stop or kill one or more processes in PowerShell. It uses the process ID or name to terminate it and only kills or stops the running process on the local computer. This post has illustrated PowerShell’s “Stop-Process” cmdlet with the aid of several examples.

Share Button

Source: linuxhint.com

Leave a Reply