Skip to main content

PowerShell Get-Service: Complete Guide to Query Windows Services

• 2 min read
powershell get-service services system-administration tutorial

PowerShell Get-Service: Complete Guide to Query Windows Services

Overview

The Get-Service cmdlet retrieves information about Windows services on local or remote computers. Services are background applications that provide system or application functionality.

Common Tasks:

  • List all services and their status
  • Find service by name
  • Filter by startup type or status
  • Query remote computers
  • Find dependent services
  • Monitor service status
  • Export service inventory

Prerequisites:

  • PowerShell 5.1 or later
  • Administrator privileges recommended
  • Network access for remote queries

Syntax

Get-Service [-Name <string>] [-DisplayName <string>] [-ComputerName <string[]>] [-Exclude <string>] [-Include <string>]

Key Parameters

ParameterTypeDescription
-NameStringService name (short name)
-DisplayNameStringService display name
-ComputerNameString[]Query remote computer
-ExcludeStringExclude services by name
-IncludeStringInclude services by pattern

Examples

Example 1: List All Services

Get-Service | Select-Object Name, DisplayName, Status, StartType

Example 2: Get Specific Service

Get-Service -Name "Spooler"

Example 3: Find Running Services

Get-Service | Where-Object { $_.Status -eq "Running" } | Select-Object Name, DisplayName

Example 4: Find Stopped Services

Get-Service | Where-Object { $_.Status -eq "Stopped" } | Select-Object Name, DisplayName

Example 5: Find Services with Automatic Startup

Get-Service | Where-Object { $_.StartType -eq "Automatic" } | Select-Object Name, Status

Example 6: Find Services on Remote Computer

Get-Service -ComputerName "server01" -Name "SQL*" | Select-Object Name, Status

Example 7: Export Services to CSV

Get-Service | Export-Csv -Path "C:\services-$(Get-Date -Format 'yyyy-MM-dd').csv" -NoTypeInformation

Example 8: Count Services by Status

Get-Service | Group-Object -Property Status | Select-Object Name, Count

Common Use Cases

Monitor Critical Services

$critical = "w32time", "DHCP", "DNS"
Get-Service -Name $critical | Select-Object Name, Status

Find Services Not Running

Get-Service | Where-Object { $_.Status -eq "Stopped" -and $_.StartType -eq "Automatic" }

Service Startup Types

Get-Service | Group-Object -Property StartType | Select-Object Name, Count

Best Practices

✅ Monitor critical services - Track key system services ✅ Use filters - Don’t retrieve all services unnecessarily ✅ Query remote machines - Monitor multi-server environments ✅ Document service dependencies - Understand service relationships


Troubleshooting

Service Not Starting

# Check service status and startup type
$service = Get-Service -Name "ServiceName"
$service | Select-Object Name, Status, StartType

# Check if dependent services are running
Get-Service -ComputerName . | Where-Object { $_.DisplayName -like "*$($service.DisplayName)*" }

FAQs

Q: What’s the difference between Name and DisplayName? A: Name is the short name, DisplayName is the user-friendly name.

Q: Can I query multiple remote computers? A: Yes, pass array of computer names to -ComputerName.

Q: How do I see service dependencies? A: Use Get-Service and check ServicesDependedOn property.


See Also