Find Group size in active directory

Posted by Ilya Biryukov on Stack Overflow See other posts from Stack Overflow or by Ilya Biryukov
Published on 2010-06-07T18:56:25Z Indexed on 2010/06/07 19:02 UTC
Read the original article Hit count: 206

Hey I have the following code. I get a directory entry for a user (strpath). And then I get the groups where the user is listed.

How can I get the number of users in each group?

DirectoryEntry myDE = new System.DirectoryServices.DirectoryEntry(strpath);
object obGroups = myDE.Invoke("Groups");
foreach (object ob in (IEnumerable)obGroups)
{
    DirectoryEntry obGpEntry = new DirectoryEntry(ob);
    GroupsListBox.Items.Add(obGpEntry.Name );
}

© Stack Overflow or respective owner

Related posts about active-directory

Related posts about directoryservices