PowerShell provides the
Stop-Service command in order to stop services running on Windows. The Stop-Service command sends a stop message to the Windows Services Controller. The services generally stopped by using their names but there are different ways to specify names like display name, official name, etc.
Stop-Service Command Syntax
The Stop-Service command has very simple syntax where the options are provided after the command.
Even the Stop-Service command is simple and provides a little options help and information about options can be listed with the following command.
Before stopping services we should list services. The
Get-Service command can be used in PowerShell to list services. This command list services status, service name and service display name which is more human readable.
The Stop-Service command is used to stop service by providing its name which is explained in the previous part. The running service can be stopped by using its name which is different than
DisplayName . In the following example, we stop the running service named
Alternatively the service name can be specified in a more structured way by using the
-Name option like below.
Stop-Service -Name Appinfo
Stop Service Using Display Name
The running services can be stopped by using the Display Name. Display name is more human friendly and understandaable name of the service. The display name should be provided with the
-DisplayName option and provided inside the single or double quotos. In the following example we stop the service named Appinfo which display name is
Application Information .
Stop-Service -DisplayName "Application Information"
Stop Service Verbosely
The details about stopping a service can be printed by using the
-Verbose option. Even this verbose option do not provides detailed information it can be usefull for some cases.
Stop-Service -Name Appinfo -Verbose