I am trying to get users who are members of a particular group in AD.
I am trying with the following filters but i am unsuccessful.
1)
DirectoryEntry entry1 = new DirectoryEntry("LDAP://DC=xxinfo,DC=com");
string query = "(&(objectCategory=person)(objectClass=user)(memberOf=CN=Guests))";
2)
objSearchADAM.Filter = "(&(ObjectClass=user)(memberOf=CN=Network Configuration perators,CN=Builtin,DC=xxxx,DC=xxinfo,DC=com))";
also, is there any way to get users using this approach?
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
GroupPrincipal group = GroupPrincipal.FindByIdentity(ctx, "group_name");
this searches the current domain, i want to search the whole forest.is there any way to initialize ctx for whole forest?
any help would be appreciated. thank you.