Filter services by log on as account with a domain user

rated by 0 users
Not Answered This post has 0 verified answers | 3 Replies | 1 Follower

Not Ranked
2 Posts
ewbogue posted on 04-25-2012 7:00 PM

I am looking for a way to obtain a list of services filtered by the log on as account being a domain user (vs. LocalSystem, for example). I do not see that Get-Service can access that information, but Get-WMIObject win32_service can. However, when I use this syntax I receive an invalid query error:

Get-WMIObject Win32_Service -filter "startname='domain\username'"

I tested this on the Application Identity Service by using this syntax to obtain the startname property:

Get-WMIObject Win32_Service -filter "name='AppIDSvc'" | fl *

The results show the property StartName with a value matching the domain\username I set in the Services Console.

Get-Help seems to indicate that I should be able to use any property to filter my results, but this is not working.


All Replies

Not Ranked
2 Posts

Please try the following:

Get-WMIObject Win32_Service -filter "startname='domain\\username'"

should work. 

Top 10 Contributor
640 Posts

You beat me to it! The backslash is a special character in a WMI query; you escape it with a second backslash.

Not Ranked
2 Posts

Ah yes, the filter parameter requires WQL syntax. I was not aware of the \ character being special.

Thanks, it does work!

Page 1 of 1 (4 items) | RSS
Copyright 2012 All rights reserved.