Reputation: 11
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
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