Active Directory - Get Group Name RRS feed

  • Question

  • Hello everybody

    i want to retrieve all security groups in the ADS. The code belows shows how i filtered the groups.

    DirectoryEntry dir = new DirectoryEntry();
    dir.Path = "LDAP://mydomain.ch";
    DirectorySearcher sea = new DirectorySearcher(dir);
    sea.Filter = "(&(objectCategory=group)(member=*)(groupType=-2147483646))";
    SearchResultCollection results = searcher.FindAll();

    The attribute "name" and "cn" contains the groupname. But i need something like this "mydomain\GroupName"

    How can i get this information out of the ADS?

    Regards Paolo

    Tuesday, February 23, 2010 1:28 PM