This blog will talk about PowerShell’s cmdlet “Stop-Service”.
How to Use the Stop-Service (Microsoft.PowerShell.Management) Cmdlet in PowerShell?
To use the “Stop-Service” cmdlet, first, specify the stated cmdlet. Then, use the “-Name” parameter and specify a service to stop.
To learn further about the usage of the “Stop-Service” cmdlet, check out the provided examples.
Example 1: Use the “Stop-Service” Cmdlet to Stop Windows Remote Management Service
Initially, use the “Stop-Service” cmdlet. Next, place the “-Name” parameter and specify the service to stop it:
Execute the below-given command to check whether the above service was stopped or not:
Example 2: Use the “Stop-Service” Cmdlet to Stop a Service by its Display Name
First, type the “Get-Service” cmdlet. Then, use the “-DisplayName” parameter and assign the service. Next, pipe the command to the “Stop-Service” cmdlet to stop the service by its name:
Run the below-given command to verify whether the service was stopped or not:
Example 3: Use the “Stop-Service” Cmdlet to Stop Multiple Services
In order to stop multiple services, first, use the “Stop-Service” cmdlet. Then, place the “-Name” parameter and assign it multiple service names separated by commas:
That’s all! You have learned the usage of the “Stop-Service” cmdlet in PowerShell.
Conclusion
The “Stop-Service” cmdlet is utilized to stop one or more running specified services in PowerShell. It sends a stop message to Windows to stop the specified service. This guide provided the ways to stop the services by using the “Stop-Service” cmdlet in PowerShell.