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>]
```powershell

### Key Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `-Name` | String | Service name (short name) |
| `-DisplayName` | String | Service display name |
| `-ComputerName` | String[] | Query remote computer |
| `-Exclude` | String | Exclude services by name |
| `-Include` | String | Include services by pattern |

---

## Examples

### Example 1: List All Services

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

### Example 2: Get Specific Service

```powershell
Get-Service -Name "Spooler"
```powershell

### Example 3: Find Running Services

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

### Example 4: Find Stopped Services

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

### Example 5: Find Services with Automatic Startup

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

### Example 6: Find Services on Remote Computer

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

### Example 7: Export Services to CSV

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

### Example 8: Count Services by Status

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

---

## Common Use Cases

### Monitor Critical Services
```powershell
$critical = "w32time", "DHCP", "DNS"
Get-Service -Name $critical | Select-Object Name, Status
```powershell

### Find Services Not Running
```powershell
Get-Service | Where-Object { $_.Status -eq "Stopped" -and $_.StartType -eq "Automatic" }
```powershell

### Service Startup Types
```powershell
Get-Service | Group-Object -Property StartType | Select-Object Name, Count
```powershell

---

## 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

### Related Commands
- **[Start-Service](/powershell-start-service)** - Start services
- **[Stop-Service](/powershell-stop-service)** - Stop services
- **[Restart-Service](/powershell-restart-service)** - Restart services
- **[Get-Process](/powershell-get-process)** - Query processes

---

## Troubleshooting

### Service Not Starting
```powershell
# 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)*" }
```powershell

---

## 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

- **[PowerShell Start-Service](/powershell-start-service)** - Start services
- **[PowerShell Get-Process](/powershell-get-process)** - Query processes
- **Complete PowerShell Guide** - PowerShell overview

---

**Last Updated:** February 6, 2026
**Difficulty Level:** Intermediate
**Reading Time:** 10 minutes