To check service status with PowerShell, run Get-Service -Name Spooler. It returns the service's Status (for example Running or Stopped), its short Name and its DisplayName. When you also need the start mode, the account the service runs under, the process ID or the last exit code, query the Win32_Service class with Get-CimInstance. This guide shows both approaches on one computer, then on many Windows computers at once, with read-only commands you can paste as they are.
PowerShell command to check service status: quick reference
If you only need the right command, pick it from this table. Every command only reads; nothing here starts, stops or changes a service.
| To check | Command |
|---|---|
| The status of one service | Get-Service -Name Spooler |
| Just the status value, for a script | (Get-Service -Name Spooler).Status |
| Several services at once | Get-Service -Name Spooler, WinRM, BITS |
| A service when you only know part of its display name | Get-Service -DisplayName "*update*" |
| All running services | Get-Service | Where-Object Status -eq 'Running' |
| Start mode and account as well as status | Get-CimInstance Win32_Service -Filter "Name = 'Spooler'" |
| Automatic services that are not running | Get-CimInstance Win32_Service -Filter "StartMode = 'Auto' AND State <> 'Running'" |
| The status of a service on another computer | Invoke-Command -ComputerName PC01 { Get-Service -Name Spooler } |
To act on the result in a script, compare the Status property with a value such as 'Running':
$svc = Get-Service -Name Spooler -ErrorAction SilentlyContinue
if (-not $svc) {
'Spooler is not installed, or you cannot see it'
} elseif ($svc.Status -eq 'Running') {
'Spooler is running'
} else {
"Spooler status is $($svc.Status)"
}
The sections below explain each command, the properties they return and the differences between Windows PowerShell 5.1 and PowerShell 7.
Check one service with Get-Service
Get-Service is the quickest way to read a service's state. Microsoft's reference describes it as getting "objects that represent the services on a computer, including running and stopped services". Without parameters it lists every service on the local computer.
# One service by its short name
Get-Service -Name Spooler
# Several services at once
Get-Service -Name Spooler, WinRM, BITS
# Search by display name when you don't know the short name
Get-Service -DisplayName "*update*"
The short name and the display name are often different. Microsoft's Win32_Service documentation gives the example of the DHCP Client service, whose service name is Dhcp while its display name is "DHCP Client". Run Get-Service once and read the Name column when you need the exact name for a script.
Two behaviours are worth knowing before you trust the output:
- Permissions: the cmdlet can display services only when the current user has permission to see them. A service missing from the list is not proof that it isn't installed.
- Not found: asking for a name that doesn't exist produces an error. In scripts, add
-ErrorAction SilentlyContinueand test for an empty result, so one missing service doesn't stop a whole report.
List running or stopped services
Every result is an object, so you can filter on Status with Where-Object:
# Only running services
Get-Service | Where-Object { $_.Status -eq 'Running' }
# Only stopped services, sorted by name
Get-Service | Where-Object { $_.Status -eq 'Stopped' } | Sort-Object Name
If you sort by Status, stopped services appear before running ones. The reason is in the documentation: Status is an enumeration in which Stopped has the value 1 and Running has the value 4, and sorting uses the number, not the name. Add -Descending to Sort-Object to list running services first.
To see what a service depends on before you touch it, use -RequiredServices; to see what depends on it, use -DependentServices:
Get-Service -Name WinRM -RequiredServices
Get-Service -Name LanmanServer -DependentServices
Read start mode, account and process ID with Win32_Service
A stopped service is only a problem if it is supposed to be running. To judge that, you need the start mode. The Win32_Service CIM class exposes it together with other useful properties, and Get-CimInstance works the same way in Windows PowerShell 5.1 and PowerShell 7 on Windows:
Get-CimInstance -ClassName Win32_Service -Filter "Name = 'Spooler'" |
Select-Object Name, DisplayName, State, StartMode, StartName, ProcessId, ExitCode, PathName
Here is what those properties mean, based on Microsoft's class reference:
| Property | What it tells you |
|---|---|
State | Current state: Stopped, Start Pending, Stop Pending, Running, Continue Pending, Pause Pending, Paused or Unknown. |
StartMode | How the service starts: Auto, Manual or Disabled for normal services (Boot and System apply to drivers). Auto services start at system startup even if nobody logs on. |
DelayedAutoStart | True when the service starts after other auto-start services plus a short delay (Windows 10 and Windows Server 2016 or later). |
StartName | The account the service runs under. |
ProcessId | The process identifier of the running service. |
ExitCode | The Windows error code for problems starting or stopping the service. A value of 1066 means the error is specific to the service; see ServiceSpecificExitCode. |
PathName | The full path to the service binary. |
The ProcessId value also works in reverse: if a port is taken and the owning process is a shared host, our guide to finding the process using a port with PowerShell shows how to match that PID back to a service.
Note that Win32_Service also has a property called Status, but it is a general health value such as "OK" or "Degraded". For running versus stopped, read State.
Find automatic services that are not running
This is the most useful single check for a health report. It lists services set to start automatically that are currently stopped:
Get-CimInstance -ClassName Win32_Service -Filter "StartMode = 'Auto' AND State <> 'Running'" |
Select-Object Name, DisplayName, State, DelayedAutoStart, ExitCode
Expect a few results on a healthy machine: some automatic services are designed to start, finish their work and stop. Treat the list as a starting point, compare it against a known-good computer, and look at ExitCode before deciding anything is wrong. The System log often records why: filtering event logs with Get-WinEvent FilterHashtable shows how to pull Service Control Manager events, such as recently installed services, for the same computer.
The -Filter parameter takes a WQL where clause without the word WHERE. Filtering on the CIM server returns less data than fetching every service and filtering with Where-Object afterwards.
Check service status with PowerShell on a remote computer
How you query a remote computer depends on your PowerShell version, and this is the most common source of confusion.
Windows PowerShell 5.1: Get-Service -ComputerName
In Windows PowerShell 5.1, Get-Service has a -ComputerName parameter. Microsoft's documentation states that it "does not rely on Windows PowerShell remoting", so it can work even where remoting is not configured, provided the network and permissions allow it:
Get-Service -Name WinRM -ComputerName PC01, PC02 |
Format-Table MachineName, Status, Name, DisplayName -AutoSize
PowerShell 7: use Invoke-Command or CIM
PowerShell 6.0 removed the -ComputerName parameter from Get-Service; the documentation says to use Invoke-Command to target a remote system. The same release added properties such as UserName, Description, DelayedAutoStart, BinaryPathName and StartupType to the returned objects.
Invoke-Command -ComputerName PC01, PC02, PC03 -ScriptBlock {
Get-Service -Name Spooler, WinRM
} | Select-Object PSComputerName, Name, Status
Results from Invoke-Command carry a PSComputerName property, so you can tell which computer each line came from. By default it opens up to 32 connections at once (the -ThrottleLimit default). Alternatively, Get-CimInstance -ComputerName creates a temporary session over WS-Management:
Get-CimInstance -ClassName Win32_Service -Filter "Name = 'Spooler'" -ComputerName PC01, PC02 |
Select-Object PSComputerName, Name, State, StartMode
Remoting requirements
Both Invoke-Command and Get-CimInstance -ComputerName need the remote computer to accept WinRM connections. According to Microsoft's about_Remote_Requirements, Windows Server 2012 and later are enabled for PowerShell remoting by default, while client versions of Windows must be configured with Enable-PSRemoting. By default only members of the Administrators group can use the standard session configurations. If you'd rather not open WinRM on every workstation, our guide to PowerShell remote management without RDP compares WinRM, SSH remoting and agent-based options.
A reusable service status report for many computers
This script checks a list of services on a list of computers and returns one row per service, including computers that could not be reached:
$computers = 'PC01', 'PC02', 'PC03'
$services = 'Spooler', 'WinRM', 'BITS'
$results = Invoke-Command -ComputerName $computers -ErrorAction SilentlyContinue -ScriptBlock {
Get-CimInstance -ClassName Win32_Service |
Where-Object { $_.Name -in $using:services } |
Select-Object Name, State, StartMode, ExitCode
}
$results | Select-Object PSComputerName, Name, State, StartMode, ExitCode |
Sort-Object PSComputerName, Name
# Computers that returned nothing (unreachable, or none of the services exist)
$computers | Where-Object { $_ -notin $results.PSComputerName }
Check the last list by hand: a computer appears there if it could not be reached or if none of the named services exist on it. The script only reads. It is a good habit to keep status checks and changes separate: read first, decide, then change one thing and read again. Our list of read-only PowerShell commands follows the same approach, and the same pattern works for a disk space check with PowerShell across many computers.
Checking services through an RMM agent
An agent-based RMM avoids the WinRM requirement because the command is delivered to an installed agent instead of a remote shell. With EclipseRMM's PowerShell RMM, you run authorized PowerShell such as Get-Service -Name Spooler on enrolled Windows devices and review the output, errors and completion status in the portal. Two points from the product documentation matter here:
- The agent service runs as LocalSystem, so authorized commands run with high privileges. Review each command before you submit it.
- A device that is offline cannot be assumed to have run a request. Check the actual completion record, and read our note on device offline status and last seen if a device isn't reporting.
The EclipseRMM Windows agent is itself a Windows service with automatic startup, and administrators can inspect it with ordinary Windows tools. For example, Get-Service -Name '*EclipseRMM*' on the endpoint shows its status locally. If you're new to agent-based management, what is an RMM agent? explains how such a service fits into an RMM tool.
FAQ
What is the difference between Status and StartType?
Status is what the service is doing now (Running, Stopped, Paused and so on). The start type or start mode is how Windows starts it (Automatic, Manual or Disabled). A Manual service that is stopped is usually normal; an Automatic service that is stopped deserves a look.
Why does Get-Service -ComputerName fail in PowerShell 7?
Because the parameter was removed in PowerShell 6.0. Use Invoke-Command or Get-CimInstance -ComputerName, or run the command from Windows PowerShell 5.1.
Does checking a service change anything?
No. Get-Service and Get-CimInstance only read. Changing a service uses different cmdlets such as Start-Service, Stop-Service, Restart-Service and Set-Service. To make a change safely on another computer, see how to restart a service remotely with PowerShell.
Can I see drivers with Get-Service?
Normally it returns services, not drivers. Microsoft notes that if you specify the exact name of a driver, the cmdlet returns information about that driver.