Stop-Service - PowerShell command help and examples

Stops one or more running services. (Stop-Service)


NAME
Stop-Service
SYNOPSIS
Stops one or more running services.
SYNTAX
Stop-Service [-Name] <string[]> [-Exclude <string[]>] [-Force] [-Include <string[]>] [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>] Stop-Service -DisplayName <string[]> [-Exclude <string[]>] [-Force] [-Include <string[]>] [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>] Stop-Service [-InputObject <ServiceController[]>] [-Exclude <string[]>] [-Force] [-Include <string[]>] [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The Stop-Service cmdlet sends a stop message to the Windows Service Controller for each of the specified services. You can specify the services by their service names or display names, or you can use the InputObject parameter to pass a service object representing the services that you want to stop.
PARAMETERS
-DisplayName <string[]> Specifies the display names of the services to be stopped. Wildcards are permitted. Required? true Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Exclude <string[]> Omits the specified services. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as "s*". Wildcards are permitted. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Force [<SwitchParameter>] Allows the cmdlet to stop a service even if that service has dependent services. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Include <string[]> Stops only the specified services. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as "s*". Wildcards are permitted. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -InputObject <ServiceController[]> Specifies ServiceController objects representing the services to be stopped. Enter a variable that contains the objects, or type a command or expression that gets the objects. Required? false Position? named Default value Accept pipeline input? true (ByValue) Accept wildcard characters? false -Name <string[]> Specifies the service names of the services to be stopped. Wildcards are permitted. The parameter name is optional. You can use "Name" or its alias, "ServiceName", or you can omit the parameter name. Required? true Position? 1 Default value Accept pipeline input? true (ByValue, ByPropertyName) Accept wildcard characters? false -PassThru [<SwitchParameter>] Returns an object representing the service. By default, this cmdlet does not generate any output. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Confirm [<SwitchParameter>] Prompts you for confirmation before executing the command. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -WhatIf [<SwitchParameter>] Describes what would happen if you executed the command without actually executing the command. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For more information, type, "get-help about_commonparameters".
INPUTS
System.ServiceProcess.ServiceController or System.String You can pipe a service object or a string that contains the name of a service to Stop-Service.
OUTPUTS
None or System.ServiceProcess.ServiceController When you use the PassThru parameter, Stop-Service generates a System.ServiceProcess.ServiceController object representing the service. Otherwise, this cmdlet does not generate any output.
NOTES
You can also refer to Stop-Service by its built-in alias, "spsv". For more information, see about_Aliases. Stop-Service can control services only when the current user has permission to do so. If a command does not work correctly, you might not have the required permissions. To find the service names and display names of the services on your system, type "get-service". The service names appear in the Name column and the display names appear in the DisplayName column.

Examples

EXAMPLE 1
C:\PS>stop-service sysmonlog
Description
----------- This command stops the Performance Logs and Alerts (SysmonLog) service on the local computer.
EXAMPLE 2
C:\PS>get-service -displayname telnet | stop-service
Description
----------- This command stops the Telnet service on the local computer. The command uses the Get-Service cmdlet to get an object representing the Telnet service. The pipeline operator (|) pipes the object to the Stop-Service cmdlet, which stops the service.
EXAMPLE 3
C:\PS>get-service iisadmin | format-list -property name, dependentservices C:PS>stop-service iisadmin -force -confirm
Description
----------- The Stop-Service command stops the IISAdmin service on the local computer. Because stopping this service also stops the services that depend on the IISAdmin service, it is best to precede the Stop-Service command with a command that lists the services that depend on the IISAdmin service. The first command lists the services that depend on IISAdmin. It uses the Get-Service cmdlet to get an object representing the IISAdmin service. The pipeline operator (|) passes the result to the Format-List cmdlet. The command uses the Property parameter of Format-List to list only the Name and DependentServices properties of the service. The second command stops the IISAdmin service. The Force parameter is required to stop a service that has dependent services. The command uses the Confirm parameter to request confirmation from the user before stopping each service. RELATED LINKS Online version: http://go.microsoft.com/fwlink/?LinkID=113414 Get-Service Suspend-Service Start-Service Restart-Service Resume-Service Set-Service New-Service C:\Windows>powershell get-help Start-Service -full

Microsoft Windows [Version 10.0.19045.3693]
Copyright (c) 2023 Microsoft Corporation.

ColorConsole [Version 3.7.1000] PowerShell 2.0-Export

Windows 11, 10, 8.1, 8, 7 / Server 2022, 2019, 2016











Windows-10


... Windows 10 FAQ
... Windows 10 How To


Windows 10 How To


... Windows 11 How To
... Windows 10 FAQ



PowerShell: Stops one or more running services.

HTTP: ... PS_Windows/en/Stop-Service.htm
0.061
12614
Problems opening docx documents with old MS Office Word!
Can I also use the compare tool for my smartphone or iPhone created pictures?
Herunterfahren, Hochfahren was ist Besser unter MS OS?
Wie startet man bei Windows die Dienstprogramme neu?
Windows 10 slow startup of programs and high CPU load, what to do?
Kids login protection under Windows 10 / 11 on tablet or desktop PC!
Kann ich SmartScreen aktivieren und deaktivieren?
Alle Computer in ihrem wifi (w-lan) Netzwerk unter Windows-10 sehen?
WordPad doesn't display letters when typing, why?
Outlook 2016 I receive the error message, not an .ost file!



(0)