0
0
PowershellHow-ToBeginner · 3 min read

How to Get Service in PowerShell: Syntax and Examples

Use the Get-Service cmdlet in PowerShell to retrieve information about services on your computer. You can specify a service name or get all services by running Get-Service without parameters.
📐

Syntax

The basic syntax of Get-Service is simple and flexible:

  • Get-Service: Lists all services on the local computer.
  • Get-Service -Name <ServiceName>: Retrieves a specific service by its name.
  • Get-Service -DisplayName <DisplayName>: Retrieves a service by its display name.

You can also filter services using wildcards like *.

powershell
Get-Service [-Name] <string[]> [-DisplayName] <string[]>
💻

Example

This example shows how to get the status of the Windows Update service by its name and how to list all services:

powershell
Get-Service -Name wuauserv

Get-Service | Select-Object -First 5
Output
Status Name DisplayName ------ ---- ----------- Running wuauserv Windows Update Status Name DisplayName ------ ---- ----------- Running AdobeARMservice Adobe Acrobat Update Service Stopped AJRouter AllJoyn Router Service Running ALG Application Layer Gateway Service Stopped AppIDSvc Application Identity Running Appinfo Application Information
⚠️

Common Pitfalls

Common mistakes when using Get-Service include:

  • Using incorrect service names or display names, which causes no results.
  • Not using quotes when the service name contains spaces.
  • Expecting Get-Service to show detailed service properties like startup type (it does not).

Always verify the exact service name with Get-Service or use wildcards.

powershell
## Wrong: Missing quotes for display name with spaces
Get-Service -DisplayName "Windows Update"

## Right: Use quotes
Get-Service -DisplayName "Windows Update"
📊

Quick Reference

ParameterDescriptionExample
-NameSpecify service name(s) to getGet-Service -Name wuauserv
-DisplayNameSpecify display name(s) to getGet-Service -DisplayName "Windows Update"
No parametersGet all servicesGet-Service
WildcardsUse * to match multiple servicesGet-Service -Name "win*"

Key Takeaways

Use Get-Service to retrieve service information by name or display name.
Enclose service names with spaces in quotes to avoid errors.
Get-Service lists basic service info; use other cmdlets for detailed properties.
Wildcards help find multiple services matching a pattern.
Verify service names to avoid empty results.