PowerShell: Stop a Windows Service
Need to stop a running Windows service - to troubleshoot a stuck process, free up resources, or apply a config change that requires the service to be down? This one-liner stops it directly from the terminal.
Prerequisites:
- Privileges: Run as Administrator
- Module: Built-in, no import needed
Quick Command:
Stop-Service YourServiceName -PassThru
Example Output:
Status Name DisplayName
------ ---- -----------
Stopped YourServiceName Your Service Display Name
📦
Want all of them at once?
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
How It Works:
- Stop-Service stops the specified service if it's currently running.
- Replace YourServiceName with the service's actual Name property.
- By default this produces no output on success. Adding -PassThru returns the service object so you can confirm the new status.
Pro Tip:
If you're not sure of a service's exact name, search for it first:
Get-Service *keyword*