14.2. Administering Services

When working with services, PowerShell passes around System.ServiceProcess. ServiceController objects. The simplest way to get those objects for one or many services is to use the Get-Service cmdlet. When called without parameters, it will return all services registered on the system. We can use the cmdlet to generate quick reports. For example, this command will list just the running services:

Get-Service | where { $_.Status -eq "Running" }
Here is what the result looks like:
Status   Name               DisplayName
------   ----               -----------
Running  AeLookupSvc        Application Experience
Running  Appinfo            Application Information
Running  AudioEndpointBu... Windows Audio Endpoint Builder
Running  Audiosrv           Windows Audio
...

We can search for ...

Get Pro Windows PowerShell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.