posts - 598 , comments - 849 , trackbacks - 247

My Links

News

qrcode

Lance Robinson

Create Your Badge

Lance Robinson is a software engineer in Durham, Chapel Hill, Raleigh, and surrounding areas. More about Lance.

 Subscribe

Tag Cloud

Article Categories

Archives

Post Categories

Blogs

Miscellanous

Noteworthy Stuff

Popular Posts

LDAP - Search for What Groups a Particular User Belongs to

In the last LDAP series post, I mentioned how to search for the members of a group.  Now the opposite, here's how to search for what groups a particular user is a part of:

To do this search, all I do is form a search filter that is searching for all groups that has a particular member in it.  So really this is a slight alteration of the search for all groups.

PS C:\> get-ldap -server testboy -cred $mycred -dn dc=JUNGLE -searchscope wholesubtree 
-search "(&(member=CN=Lance Robinson,CN=Users,DC=JUNGLE)(objectcategory=group))"

Host DN
---- --
testboy CN=Domain Admins,CN=Users,DC=JUNGLE
testboy CN=DnsAdmins,CN=Users,DC=JUNGLE

PS C:\>


Here I can see that I (CN=Lance Robinson,CN=Users,DC=JUNGLE) am a member of two groups:  Domain Admins and DNS Admins.  That sounds a lot cooler than it actually is since "testboy" is just a test machine.  ;)

Technorati Tags: , , ,

Print | posted on Friday, August 3, 2007 12:51 PM | Filed Under [ PowerShell ]

Feedback

Gravatar

# re: LDAP - Search for What Groups a Particular User Belongs to

Hi,

Is it possible that we get all groups that particular user belongs to, for both direct and indirect?

Kindly suggest, please.

Thanks & Regards,
Nidjarin
2/23/2010 1:49 AM | Nidjarin K.
Post A Comment
Title:
Name:
Email:
Comment:
Verification:
 

Powered by: