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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.