Stop one or more running services.
Syntax
Stop-Service { [-name] string[]
| [-displayName] string[]
| [-inputObject ServiceController[]] }
[-include string[]] [-exclude string[]]
[-force] [-passthru] [-whatIf]
[-confirm] [CommonParameters]
Key
-name string
The service names to be stopped.
-displayName string
The display names to be stopped, wildcards are permitted.
-inputObject ServiceController
Stop the services represented by ServiceController.
Enter a command, expression or variable contains the objects.
-include string
Stop only the specified services. qualifies the Name parameter.
Wildcards , such as "s*" are permitted.
-exclude string
Omit the specified services e.g. "*SS64*"
this only works when the path includes a wildcard character.
-force
Override restrictions that prevent the command from succeeding, apart
from security settings. e.g. -Force will stop a service
that has dependent services.
-passThru
Pass the object created by Stop-Service along the pipeline.
-whatIf
Describe what would happen if you executed the command without
actually executing the command.
-confirm
Prompt for confirmation before executing the command.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.
Examples
Stop the Performance Logs and Alerts (SysmonLog) service on the local computer.:
PS C:\>stop-service sysmonlog
Use -force to stop a service that has dependent services, when doing this it is best to first list all the dependant services with Get-Service:
PS C:\>get-service iisadmin | format-list -property name, dependentservices
PS C:\>stop-service iisadmin -force -confirm
“The question isn't who is going to let me; it's who is going to stop me” - Ayn Rand
Related Powershell Commands:
Get-Service - Get a list of services
New-Service - Create a new service
Restart-Service - Restart a stopped service
Resume-Service - Resume a suspended service
Set-Service - Make and set changes to the properties of a service
Start-Service - Start a stopped service
Suspend-Service - Suspend a running service
Windows cmd commands: NET START / SC - Service Control