Powershell

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

To stop running services, the “Stop-Service” cmdlet can be used in Powershell. Whenever this cmdlet gets executed, it sends a message to the “Windows Service Controller” to stop the specified service with immediate effect. Services can be provided to the “Stop-Service” cmdlet by their names and display names. The standard alias for the stated cmdlet is the “spsv”.

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:

Stop-Service -Name "WinRM"

Execute the below-given command to check whether the above service was stopped or not:

Get-Service -Name "WinRM"

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:

Get-Service -DisplayName "SysMain" | Stop-Service

Run the below-given command to verify whether the service was stopped or not:

Get-Service -DisplayName "SysMain"

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:

Stop-Service -Name wisvc, vmicvss, PlugPlay

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.

About the author

Muhammad Farhan

I am a Computer Science graduate and now a technical writer who loves to provide the easiest solutions to the most difficult problems related to Windows, Linux, and Web designing. My love for Computer Science emerges every day because of its ease in our everyday life.