get running service list using powershell

How to Get Running Windows Services list using PowerShell?

Windows PowerShell is a powerful tool that is developed by Microsoft for purposes of task automation and configuration management. This is based on the .NET framework and it includes a command-line shell and a scripting language. Windows PowerShell is designed especially for system administrators. If you are a windows administrator and if you know PowerShell very well and you can simplify and automate tedious and repetitive tasks by creating scripts and combining multiple commands together. If you are an IT admin then learning PowerShell gives you skills crucial for managing IT at any kind of business. In this article, we are going to see how to get the list of Windows Services, and how to group them and how to get the list of stopped or running Windows Services using PowerShell.

Get Running Windows Services list using PowerShell:

In Windows You can enable or disable Windows Services using the Service management console, using Services Management Console you can easily get the list of Stopped or running services list. But what if you need to create a script to get the running services list. Using PowerShell you can easily create a Script to get stopped or running services list.

First, we need to get all the services list, Open the PowerShell in elevated mode and type the following command and hit enter.

Get-Service

This command will list out all the Running and stopped Windows services list from the Windows Services management console.

If you want to know how many running services, or stopped services then use the following PowerShell cmdlet.

Get-Service | Group-Object -property status

get service group object

This command will list the number of running and stopped Windows Services. If you don’t want any extra elements, then you can use the following command to know the status of running or stopped windows services.

Get-Service | Group status -NoElement

There are number of ways to get the list of stopped or running services, here I am going to show all the different methods.

First Using the Group-Object cmdlet we can return a hash table of information, First, we need to pipe the objects to the Group-Object cmdlet, then use the AsHashTable and AsString Switched parameter to store the resulting hash table in a variable.

$hash = Get-Service | group status -AsHashTable -AsString

Now we stored all the Stopped and running service lists in a $hash variable, using this variable you can easily retrieve the required service list. For example, to get the running windows service list, just type the following command.

$hash.running

running Windows service

So, this command will disable the hash table of service information and to access the running services by using the dotted notation.

You can get the specific service information by typing the array number in the square brackets, if you type the exact array number the following command will show the specific service information.

$hash.running[12]

If you want to search for any specific service information, use the following command.

$hash.running | ? {$_.name -match “bfe”}

search Windows Services list using PowerShell

So in this command, we are using the Where-Object command alias ? symbol, and using the pipe the search result will store in and variable and display the final results.

If you want the results in the Grid view, then you can use the Out-GridView cmdlet, this command will show the results in the Grid View, the Grid view allows users to search filter by the specific parameter. The results will look like this.

Get-Service | Where Status -eq "Running" | Out-GridView
grid view of running Windows Services list using PowerShell

If you want the stopped service list, then replace the Running text with the Stopped text. This will list out the Stopped Windows Service list. Read this article to Start or Stop Windows Service using PowerShell.

If you want to export the list then use the following command.

Get-Service | Where-Object {$_.Status -eq "Running"} | Out-File -filepath "C:\Users\<UserName> \Documents\WinServicelist.txt"

Replace the file path here, this command will save the list of running windows services as text format in mentioned location path.

Read Also:

How to Delete a Windows Services using Registry or command-line?

How to remove Windows Service in Windows 11?

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top