Stop-Service

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*"
       Qualifies the -Name parameter, Wildcards are permitted.

   -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.

Standard Aliases for Stop-Service: spsv

-ServiceName is an alias for -Name.

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, the first command below lists the dependant services of iis:

PS C:\> get-service iisadmin | format-list -property name, dependentservices
PS C:\> stop-service iisadmin -force -confirm

“It [the Cheshire Cat] vanished quite slowly, beginning with the end of the tail, and ending with the grin, which remained some time after the rest of it had gone” ~ Lewis Carroll

Related PowerShell Cmdlets

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 command: NET START / SC - Service Control.


 
Copyright © 1999-2024 SS64.com
Some rights reserved