public string LDAP_GetPCgroupslist(string sPCName)
string str_GetPCgroupslist = "";
string str_fullgroupslist = "";
DirectoryEntry searchRoot = new DirectoryEntry("LDAP://" + sDefaultOU);
DirectorySearcher search = new DirectorySearcher(searchRoot);
search.Filter = "(name=" + sPCName + ")";
search.PropertiesToLoad.Add("memberOf");
SearchResultCollection groups = search.FindAll();
foreach (SearchResult sr in groups)
str_GetPCgroupslist = (sr.Properties["memberOf"][i].ToString());
int index = str_GetPCgroupslist.IndexOf(",OU=");
{ str_GetPCgroupslist = str_GetPCgroupslist.Substring(0, index); }
str_GetPCgroupslist = str_GetPCgroupslist.Substring(3) + "\r\n";
str_fullgroupslist = str_fullgroupslist + str_GetPCgroupslist;
return str_fullgroupslist;
return "Failed to load MemberOf";