mardi 2 septembre 2014

Finding AD group members on another domain


Vote count:

0




In AD we have a security group on a domain, the members of which are on another domain (Security group is on the CONTOSO domain, the members of the group are on the CORP domain).


I have some code in C# that fetches the group via a GroupPrincipal object. It should then recursively check the group for all members, and add them to a list.


If the users are on the same domain, there is no problem, and it adds the user to the list, but if the users are on a different domain to the group, it does not see them at all (The GetMembers().Count() function returns 0 even when there are users in the group).


This is the code I am using:



GroupPrincipal adminGroup = GroupPrincipal.FindByIdentity(context, adminGroupName);
foreach (UserPrincipal member in group.GetMembers(true))
{
/*
if (member == null || (string.IsNullOrEmpty(member.GivenName) && string.IsNullOrEmpty(member.Surname)))
continue;
*/
model.Owners.Add(member.GivenName + " " + member.Surname);
}


Would anyone know what I need to do in order to get the users on the other domain to show?



asked 29 secs ago







Finding AD group members on another domain

Aucun commentaire:

Enregistrer un commentaire