How To Check Windows Service Status With Get-Service Command In Powershell – POFTUT

How To Check Windows Service Status With Get-Service Command In Powershell


Service are one of the most important part of the operating systems. There are different tools and commands to list these services. Powershell provides Get-Service commandlet in order to list these services and filter them acording to the provided filter.

List All Services

We will start with a simple use case where we will list all services without providing an options to the Get-Service command. This will list currently existing service with running or stopped status.

PS> Get-Service
List All Services 
List All Services 

As we can see from screenshot services are ordered by name by default. Following information is provided by default about listed services.

  • Status will display if the service is Running or Stopped
  • Name will display the real and short name of the service which is used by commands.
  • Display Name will show extended and informative name of the service which is more human friendly.

List All Service On Remote Computer or System

As Microsoft provided remote access and management of the remote systems with powreshell we can use Get-Service command in order to list services on the remote systems. We will provide the -computername of the remote system. This can a DNS name which can be resolved or a IP address we can access.

PS > Get-Service -computername DESKTOP-HQVAMA3
List All Service On Remote Computer or System
List All Service On Remote Computer or System

List Services with Specified Name

Windows operating systems has a lot of services which will fill the terminal easily. Or we may need to list specific service name by providing its name of some part of its name. We will just provide the name after Get-Service command. We can also use * glob where only some part of the service name will be specified. In this example we will try to list WinDefend service by providing WinDef* as service name.

PS > Get-Service WinDef*
List Services with Specified Name
List Services with Specified Name

List Only Currently Running Services

There is two main service status in Windows. Running or Stopped . We may need to list services according to their status. We can use object parameter Status like below which will list only running services.

PS> Get-Service | Where-Object {$_.Status -eq "Running"}
List Only Currently Running Services
List Only Currently Running Services

List Service with Dependent Service

Services are important and may be linked and dependent to each other. Before stopping them we may need to list dependent services of the given service. We can use -RequiredServices options in order to list service dependencies.

PS> Get-Service "WinDefend" -RequiredServices
List Service with Dependent Service
List Service with Dependent Service

List Sorted By Status (Stopped/Running)

We may need to check service list according to their Running and Stopped status. We can sort them by usingSort-Object like below.

PS> Get-Service | Sort-Object status
List Sorted By Status (Stopped/Running)
List Sorted By Status (Stopped/Running)

Write Service List Into A File

We may need to investigate service list later or we just want to save them in to a file. We can use Out-File command which will write the service list the file we want. In this example we will write into a file named Services.txt

PS> Get-Service | Out-File "C:\Users\İsmail Baydan\Desktop\Services.txt"

LEARN MORE  How To Manage Windows Services with services.msc

2 thoughts on “How To Check Windows Service Status With Get-Service Command In Powershell”

Leave a Comment