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:
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:
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:
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:
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.