How to determine whether a user account is a (indirect) member of an AD group?
问题 How to determine whether a user account is a member of an AD group, especially when then user is not a direct member of the group An example: user1 is member of group1 group1 is member of group2 result of a (fictional) function call IsUserMemberOf('user1', 'group2') should be TRUE For .NET there is a solution: static bool IsUserMemberOf(string userName, string groupName) { using (var ctx = new PrincipalContext(ContextType.Domain)) using (var groupPrincipal = GroupPrincipal.FindByIdentity(ctx,