The following code works for 90+ % of global security groups, but for one very large global security group, it returns an enumerator, but no member objects of the group, even though the group has many thousands.
DirectoryEntry group = groupResult.GetDirectoryEntry(); filter = 'member;range=0-20'; group.RefreshCache(new[] { filter }); PropertyValueCollection groupMembers = group.Properties['member']; IEnumerator iEnum = groupMembers.GetEnumerator(); //On one large global security group, this returns a valid iEnum, //but no member entries. The group has thousands. //This code works for every other group I've encountered.
The problem may not be with your code, but with access security in your directory – you may not have rights to enumerate the members of that group.