Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Say, if I have a DN for a workstation "CN=XP3-1,CN=Computers,DC=mydomain,DC=local".

How do you write a filter to list all groups that this workstation is a member of?

$filter = "(&(objectCategory=group)(objectClass=group)(name=*)(member=" & $workstationDN & "))"

Returns nothing...

PS. Sorry, my knowledge of PowerShell can fit into a thimble.

share|improve this question
You might want to clarify whether you want only the direct group memberships or all of the recursive group memberships this computer might be a member of via nested groups. –  Ryan Bolger Nov 13 '12 at 7:27

1 Answer 1

Remove the double quotes around the workstation's distinguished name and you should be there:

$filter = "(&(objectCategory=group)(objectClass=group)(name=*)(member=$workstationDN))"

Also, as Ryan Bolger points out, this will only get the groups that the workstation is DIRECTLY a member of, not any groups that those groups might be in.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.