Viktor Balaban
Viktor Balaban

Reputation: 11

Powershell Get-Service to show all services executed with specific service account name

How to sort the services under windows 2012r2 with powershell to show only ones executed with service account "...name..." In the enterprise domain environment

Upvotes: 1

Views: 2539

Answers (1)

Enrico Campidoglio
Enrico Campidoglio

Reputation: 59983

You can do that by querying the WMI Win32_Service class using the Get-WmiObject cmdlet.

For example, this will retrieve all the Windows Services that run under the LocalSystem account:

Get-WmiObject -Query "select name, startname from Win32_Service where startname = 'LocalSystem'"

Alternatively, you can retrieve all Windows Services from WMI and filter them in PowerShell using:

Get-WmiObject Win32_Service | where StartName -eq "LocalSystem"

Upvotes: 1

Related Questions