Active Directory Ldap query to get all users of the same primary group of a user -
i need ldap query windows server 2012 ad starting username of user , getting collegues. in ad collegues ad identified same primary group. possibile or should need 2 step query?
thank you.
unfortunately, ldap filtering syntax not allow sub-queries within expression.
you'd have break 2 parts - first user's directoryentry record, use primarygroupid in separate filter, :
(&(objectclass=user)(samaccountname=jsmith)
now let's jsmith part of default "domain users" group (513) :
(&(objectcategory=person)(objectclass=user)(primarygroupid=513))
this return users share same primarygroupid.
Comments
Post a Comment