0
0
PowershellHow-ToBeginner · 3 min read

How to Stop a Service Using PowerShell Quickly

Use the Stop-Service cmdlet in PowerShell to stop a running service by its name or display name. For example, Stop-Service -Name 'wuauserv' stops the Windows Update service.
📐

Syntax

The basic syntax to stop a service in PowerShell is:

  • Stop-Service -Name <ServiceName>: Stops the service by its system name.
  • Stop-Service -DisplayName <DisplayName>: Stops the service by its friendly display name.
  • -Force: Optional parameter to force stop the service if it does not stop gracefully.
powershell
Stop-Service -Name <ServiceName> [-Force]
💻

Example

This example stops the Windows Update service using its service name wuauserv. It shows how to run the command and the expected result.

powershell
Stop-Service -Name wuauserv
Get-Service -Name wuauserv | Select-Object Status
Output
Status ------ Stopped
⚠️

Common Pitfalls

Common mistakes when stopping services include:

  • Using the wrong service name or display name, which causes the command to fail.
  • Not running PowerShell as Administrator, which is required to stop most services.
  • Not using -Force when a service refuses to stop gracefully.

Example of a wrong and right way:

powershell
## Wrong: Using display name with -Name parameter
Stop-Service -Name "Windows Update"

## Right: Using display name with correct parameter
Stop-Service -DisplayName "Windows Update"
📊

Quick Reference

ParameterDescription
-Name Specify the service's system name to stop it.
-DisplayName Specify the service's friendly name to stop it.
-ForceForce stop the service if it does not stop normally.
-PassThruReturns the service object after stopping it.

Key Takeaways

Use Stop-Service with -Name or -DisplayName to stop a service in PowerShell.
Run PowerShell as Administrator to have permission to stop services.
Use -Force to stop stubborn services that do not stop normally.
Verify the service name or display name before running the command.
Check the service status after stopping to confirm it stopped successfully.