PowerShell Get-Service: Check and Control Windows Services

PowerShell Get-Service: Check and Control Windows Services

PowerShell Tips Editor 2 min read
PowerShell Get-Service: Check and Control Windows Services

Windows services are the backbone of server infrastructure — they run databases, web servers, monitoring agents, and dozens of system components. When a service crashes or stops unexpectedly, you need to detect and restart it fast. PowerShell Get-Service gives you a complete, scriptable view of every Windows service and its status, with companion cmdlets to start, stop, restart, and change startup types. This guide covers the full service management workflow.

Quick Answer / TL;DR

# List all stopped services
Get-Service | Where-Object { $_.Status -eq 'Stopped' }

# Restart a service
Restart-Service -Name 'Spooler'

List All Services

Call Get-Service with no arguments to see all services and their current status:

# All services
Get-Service

# Useful columns
Get-Service | Select-Object Name, DisplayName, Status, StartType |
    Sort-Object Status, Name |
    Format-Table -AutoSize

# Count services by status
Get-Service | Group-Object Status | Select-Object Name, Count
Name                 DisplayName                          Status  StartType
----                 -----------                          ------  ---------
AdobeARMservice      Adobe Acrobat Update Service         Running Automatic
AJRouter             AllJoyn Router Service               Stopped Manual
ALG                  Application Layer Gateway Service    Stopped Manual

Name     Count
----     -----
Running    112
Stopped     76

Filter by Status (Running/Stopped)

# All running services
Get-Service | Where-Object { $_.Status -eq 'Running' }

# Simplified syntax (PS3+)
Get-Service | Where-Object Status -eq 'Stopped'

# Stopped but set to Automatic start (should be running)
Get-Service |
    Where-Object { $_.Status -eq 'Stopped' -and $_.StartType -eq 'Automatic' } |
    Select-Object Name, DisplayName, Status, StartType

# Find a specific service
Get-Service -Name 'W32Time'
Name     DisplayName                              Status  StartType
----     -----------                              ------  ---------
WSearch  Windows Search                           Stopped Automatic

Start, Stop, and Restart a Service

All three operations require administrator rights:

# Start a stopped service
Start-Service -Name 'Spooler'

# Stop a running service
Stop-Service -Name 'Spooler'

# Restart (stop then start)
Restart-Service -Name 'Spooler'

# Restart and wait for it to start completely
Restart-Service -Name 'W3SVC' -Force
Start-Sleep -Seconds 3
(Get-Service -Name 'W3SVC').Status

# Start multiple services at once
'Spooler', 'WSearch', 'W32Time' | Start-Service
Running

Use -Force with Stop-Service to also stop dependent services. Without -Force, stopping a service that has running dependents throws an error.

Change Service Startup Type

Set whether a service starts automatically, manually, or is disabled:

# Disable a service
Set-Service -Name 'Fax' -StartupType Disabled

# Set to Automatic
Set-Service -Name 'WSearch' -StartupType Automatic

# Set to Manual
Set-Service -Name 'WSearch' -StartupType Manual

# Set to Automatic (Delayed Start) — requires PS5.1+
Set-Service -Name 'BITS' -StartupType AutomaticDelayedStart

# Verify the change
Get-Service -Name 'WSearch' | Select-Object Name, StartType
Name    StartType
----    ---------
WSearch Automatic

Check Services on Remote Computer

Query services on remote machines using -ComputerName (requires WinRM):

# Get all services on a remote server
Get-Service -ComputerName 'server01'

# Check a specific service on multiple servers
$servers = @('web01', 'web02', 'db01')
$servers | ForEach-Object {
    $status = (Get-Service -Name 'W3SVC' -ComputerName $_ -ErrorAction SilentlyContinue).Status
    [PSCustomObject]@{
        Server  = $_
        W3SVC   = $status ?? 'Not Found'
    }
}
Server W3SVC
------ -----
web01  Running
web02  Running
db01   Not Found

Export Service Report to CSV

# Full service inventory
Get-Service |
    Select-Object Name, DisplayName, Status, StartType,
        @{ Name='CanStop'; Expression={ $_.CanStop } } |
    Sort-Object Status, Name |
    Export-Csv 'C:\Reports\services.csv' -NoTypeInformation

# Report only stopped automatic services — potential problems
Get-Service |
    Where-Object { $_.Status -eq 'Stopped' -and $_.StartType -eq 'Automatic' } |
    Select-Object Name, DisplayName, Status, StartType |
    Export-Csv 'C:\Reports\stopped-auto-services.csv' -NoTypeInformation

Write-Output "Report saved"

Common Errors and Fixes

  • Start-Service requires admin privileges: Without an elevated session, starting or stopping services throws “Access is denied.” Right-click PowerShell and run as Administrator, or use Start-Process powershell -Verb RunAs to relaunch elevated.
  • Service display name vs service name — both work but be consistent: Get-Service -Name 'Print Spooler' uses the display name; Get-Service -Name 'Spooler' uses the service name. The -Name parameter accepts both, but scripting with the service name (not display name) is more reliable across localized Windows editions.

Related Cmdlets / See Also

Wrapping Up

Get-Service, Start-Service, Stop-Service, Restart-Service, and Set-Service together handle all Windows service management from PowerShell. Filter stopped automatic-start services to find potential issues, use -ComputerName for remote management, and export reports with Export-Csv. All write operations require elevation. Your next step: write a monitoring script that checks critical services every 5 minutes and sends an alert if any are stopped.

Send-Item -To