PowerShell Tip of the Week: Get-Service example

Starting from today we will add also short articles with simple PowerShell examples once per week. Below you can find how to use Get-Service command against several servers and get nice formatted output.


The Get-Service cmdlet gets objects that represent the services on a local computer or on a remote computer, including running and stopped services.

In this example we will limit our query to 4 properties:

– MachineName
– Name
– Displayname
– Status

To list all available service properties you can run:

Get-Service -ComputerName DC01 -Name HealthService | Select-Object *


Get-Service -ComputerName DC01 -Name HealthService | Get-Member -MemberType Properties
service properties
service properties

Final script:

Get-Service -ComputerName DC01,DC02 -Name HealthService | Select-Object MachineName,Displayname,Name,Status


Get-Service -Computername ( Get-Content -path "c:\temp\servers.txt" ) -Name HealthService | Select-Object MachineName,Name,Displayname,Status | Sort-Object Status



For more Get-Service examples please visit Microsoft docs site.

Leave a Reply

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.