GetMembers(true) don't list all users of membergroup

122 views Asked by At

at first here is my code:

PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "Domain");
GroupPrincipal gpx = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name, "otheradmingroup");

List<string> Members = new List<string>();
foreach(Principal member in gpx.GetMembers(true))

{
    Members.Add(member.SamAccountName.ToLower());
}

gpxAdmins.Dispose();

ctx.Dispose();

return Members;

the only member of my "otheradmingroup" is the "Domain Admins" group, which contains 6 ad-users.

after executing this code above, the returned list contains only the first 4 members of my "Domain Admins"

1

There are 1 answers

0
Fred On

I've found the Problem.

The GetMembers() Method don't find users which have this group as there primary group.