Which PowerShell command lists all services on a Windows host?

Study for the SANS560 GIAC Penetration Tester (GPEN) Test. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Multiple Choice

Which PowerShell command lists all services on a Windows host?

Explanation:
PowerShell has a cmdlet specifically for querying Windows services. Get-Service enumerates services from the Service Control Manager and returns objects that include Name, DisplayName, and Status. Running it with no parameters lists every service on the local machine, and you can narrow the results with -Name or by piping to Where-Object to filter by status, such as Get-Service | Where-Object {$_.Status -eq 'Running'}. This directly targets services, making it the appropriate tool for listing all services. Other commands don’t list services: Get-Process shows active processes, Get-EventLog reads event logs, and Get-Item retrieves a filesystem or registry item.

PowerShell has a cmdlet specifically for querying Windows services. Get-Service enumerates services from the Service Control Manager and returns objects that include Name, DisplayName, and Status. Running it with no parameters lists every service on the local machine, and you can narrow the results with -Name or by piping to Where-Object to filter by status, such as Get-Service | Where-Object {$_.Status -eq 'Running'}. This directly targets services, making it the appropriate tool for listing all services. Other commands don’t list services: Get-Process shows active processes, Get-EventLog reads event logs, and Get-Item retrieves a filesystem or registry item.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy