PowerShell: Restart a Windows Service
Need to restart a Windows service - after a config change, to clear a stuck state, or as part of routine troubleshooting? This one-liner restarts it directly from the terminal.
Prerequisites:
- Privileges: Run as Administrator
- Module: Built-in, no import needed
Quick Command:
Restart-Service YourServiceName -PassThru
Example Output:
Status Name DisplayName
------ ---- -----------
Running YourServiceName Dell 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:
- Restart-Service stops and starts the specified service in one step.
- 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*