December 22nd, 2004, 03:58 AM
Prrimary Groups - retrive members
Hi to you all,
I've encountered a problem with my project,
I'm trying to retrive all members of each group in the A.D (include security groups) of a domain.
the proccess goes like this. I'm enquiring the ldap using directory searcher, for retriving of all groups using the full subtree. After reciving results I'm walking thru each result and retrive its members.
The problem arise when the proccess comes to a group such as "Domain Users" which is a "primary group". on such a group the "member"/"member of" property dosen't seem to work.
I know that there must be a way of retriving the members o such groups so I chalenge you.
I will be more than happy to get ideas
here is part of the code:
searchRoot = new DirectoryEntry(sLDAPRoot, sLDAPUser, sLDAPPassword);
DirectorySearcher ds = new DirectorySearcher(searchRoot,"(objectCategory=group)");
ds.SearchScope = SearchScope.Subtree;
ds.ServerTimeLimit = new TimeSpan(0,0,0,120,0);
SearchResultCollection src = ds.FindAll();
foreach (SearchResult sr in src)
foreach (string member in sr.Properties["member"])
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!