public void EnumGroupMembers(DirectoryEntry groupEntry, Action<SearchResult> action) { groupEntry.NullCheck("groupEntry"); StringBuilder strB = new StringBuilder(256); foreach (string dn in groupEntry.Properties["member"]) { strB.AppendFormat("(distinguishedName={0})", dn); } if (strB.Length > 0 && action != null) { ADSearchConditions condition = new ADSearchConditions(); condition.Scope = SearchScope.Subtree; string filter = string.Format("(&(objectCategory=Person)(objectClass=person)(|{0}))", strB.ToString()); using (DirectoryEntry entry = this.GetRootEntry()) { foreach (SearchResult sr in this.ExecuteSearch(entry, filter, condition, DefaultADObjProperties)) { action(sr); } } } }