Windows Services are used to provide different functionalies. There are native and 3r party services for different tasks like printing, wireless management, ftp server etc. Even services are generally degisned to run in some cases they can be stopped. PowerShell provides the Get-Service
command in order to list services and related information with their status. In this tutorial we examine how to get service status in PowerShell and filter services status with service name.
Display Services with Status Information
The Get-Service command displays all services with information like Status, Name, and Display Name. The Status column provides information like Running
and Stopped
. The Name
column displays the service conical name that is used by Windows. The DisplayName
column displays the human-readable name of the service.
Display Running Services
We can use the Status
attribute of the service list in order to display only running services. We should use the Where-Object
command to filter only running services.
PS> Get-Service | Where-Object {$_.Status -eq "Running"}

Display Stopped Services
We can display stopped or not running services with the following command.
PS> Get-Service | Where-Object {$_.Status -eq "Running"}

Display Running Services with Specified Name
We can search for a specified service with its name and status. In the following example, we search the service whose name contains the term “win” which status is running.
PS> Get-Service "*win*" | Where-Object {$_.Status -eq "Running"}

Display Stopped Services with Specified Name
We can search for a specified service with its name and status. In the following example, we search the service whose name contains the term “win” whose status is stopped.
PS> Get-Service "*win*" | Where-Object {$_.Status -eq "Stopped"}