I created one ParentDomain ADDomain1 having a child ADDomain2. In ADDomain2 I created a Group 'Common Users' in this I have users both from ADDomain1 as well ADDomain2, but when I do a directory search for a ADDomain1 user in ADDomain2 it doesn't retuen any result. here is a code
DirectorySearcher directorySearcher = new Directory开发者_开发知识库Searcher();
 DirectoryEntry directoryEntry = new DirectoryEntry("LDAP://ADDomain2","UserName","Password");
directoryEntry.Path = "LDAP://ADDOMAIN2/DC=ADDOMAIN2,DC=ADDOMAIN1,DC=WAVEDOMAIN";
directorySearcher.SearchRoot = directoryEntry;
            directorySearcher.FindOne();
directorySearcher.PageSize = 1000;
            directorySearcher.Filter = "(&(objectCategory=person)(name=ADDOMAIN1User))";
SearchResultCollection results = directorySearcher.FindAll();
But when I search for ADDOMAIN2 user it returns results.
Any Idea?
Thanx
I don't know about DirectoryEntry, does it work with UserPrincipal? Is AD2 a global catalog?
Sample:
using System.DirectoryServices.AccountManagement;
var ctx = new PrincipalContext(ContextType.Domain, "ADDOMAIN2");
var usr = UserPrincipal.FindByIdentity(ctx, IdentityType.SamAccountName, "whatever");
// you can also find the GroupPrincipal and get its members
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论