Reputation: 24480
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.
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.
Upvotes: 2
Views: 1716
Reputation: 3177
If an application stores or caches identifiers or references to objects stored in Active Directory Domain Services, the object GUID is the best identifier to use for several reasons:
On the other hand an object's distinguished name changes if the object is renamed or moved, therefore the distinguished name is not a reliable object identifier.
So it is not about Performance, its about Relaibility that you should search the directory using objectGUID.
Coming to your next question:
Is it possible to query for groups containing a user/group by objectGuid?
Ofcourse Yes. Check this link.
Hope it helps !!
Upvotes: 7