I am trying to enumerate all the users of the Enterprise Admins group.
I have tried the following:
PrincipalContext ctx = new PrincipalContext(ContextType.domain,"globalcatalog.domain.local", "DC=domain,DC=local");
GroupPrincipal grp = GroupPrincipa,FindByIdentity(ctx, IdentityType.Name, "Enterprise Admins");
IList<string> users = new List<string>();
foreach(Principal p in grp.Getmembers(true)){
users.Add(p.Name);
}
Unfortunately, i will consistently get an error that says A referral was returned from the server. Is there anything I am missing here? I would rather not go back to using the DirectoryEntry class, but looks like I might have to.