0

I have seen solutions for getting back all groups a user belongs to, however I cant find a solution that returns them back with their respective display names.

I know that you can iterate over each group and get additional info such as display name, however I am concerned about the performance of iterating queries over a large array of groups. If i am getting back only the Alias when fetching groups, and I have 120 groups return for a user, I dont want to have to make an additional 120 queries in a loop for additional properties such as display name.

Is there an efficient way to take a username, and from that return back a list of all groups the user is in by display name without having to perform additional iterative queries?

Looking for a solution in c# .net

Delgim
  • 1
  • 1
  • Perhaps you could do this through WMI https://stackoverflow.com/questions/4794624/wmi-retrieve-groups-that-a-user-is-member-of – Alexandru Clonțea Sep 21 '18 at 13:25
  • You have 3 options here: the first one is to query tokengroups and retrieve every every group display name using sid binding, which is fast, the second one is to query tokengroups and retrieve all display via or operator (combine all sids in one query, e. g. sid=sid1 or sid=sid2..., which, I believe will be a slightly faster solution, but need to check, and the third one is to query memberof with attribute scope query filter. This option has many limitations (nested groups, groups from other domains) but seems to be the fastest one – oldovets Sep 22 '18 at 10:44

0 Answers0