jdgregson
jdgregson

Reputation: 1587

List all services in PowerShell

There are some services in Windows (such as http and USBStor) which are not listed when you view Services, or when running the Get-Service cmdlet. What is the simplest way to list all services, even the hidden or unlisted ones?

For example, the http and USBStor services are not enumerated when listing services, but they can be accessed directly by name:

PS C:\Windows\System32> Get-Service | Where-Object {"http","usbstor","spooler" -contains $_.Name}

Status   Name               DisplayName
------   ----               -----------
Running  Spooler            Print Spooler


PS C:\Windows\System32> Get-Service "http","usbstor","spooler"

Status   Name               DisplayName
------   ----               -----------
Running  http               HTTP Service
Running  spooler            Print Spooler
Stopped  usbstor            USB Mass Storage Driver

Upvotes: 0

Views: 12330

Answers (2)

swbbl
swbbl

Reputation: 864

Try 'Get-CimInstance'.

Such functions (Get-Service) delivered by Microsoft rely on and use CIM/Win32 classes.

(Get-Service only shows Windows services. 'HTTP' is a system driver.)

Get-CimInstance 'CIM_Service'

Upvotes: 1

Jawad
Jawad

Reputation: 11364

This might not be the most elegant way of getting all the services (hidden per say), but this will give you all the services along with ones these are dependent on.

Get-Service -RequiredServices | select -Unique DisplayName | ? {$_.DisplayName -like "Http*" }

Upvotes: 3

Related Questions