I'm writing some code to work with Active Directory. This code includes functions to pull back a user given their account name, then get direct reports and get group memberships (these can be run recursively or non-recusively depending if the full hierarchy is required). I've seen a few answers on how this can be done. However all answers seem to rely on the Distinguished Name.
Is the Distinguished Name the foreign key (in database terms) used to relate these objects in active directory? My intuition suggests that the objectGuid would be the key used to relate items to one another as that will never change. As a result I'd assume performance would be better if I rewrote the queries to use objectGuid over DN.
- is it possible to query for groups containing a user/group by objectGuid?
- is it possible to query for the objectGuids of direct reports for a given manager (objectGuid).
- do objectGuid queries outperform other attributes, or is DN, sAMAccountName, or one of the other key attributes the best key to use from a performance perpective?
- are the above answers true of most(all?) LDAP implementations, or are they specific to MS AD?
Thanks in advance,
JB
ps. as with most of my questions, the performance difference is probably negligible; this is more for academic interest / satisfying my curiosity.