用java获取AD域中的用户以及组的所有信息

解决方案 »

  1.   

    哎,可怜啊,这个难搞哦,给你一段参考(不过这是C#的):myLDAPPath = "LDAP://你的域名"; DirectoryEntry mySearchRoot = new DirectoryEntry(myLDAPPath);
    DirectorySearcher myDirectorySearcher = new DirectorySearcher(mySearchRoot); #region all informations myDirectorySearcher.Filter = ("(objectClass=user)"); //user表示用户,group表示组
    foreach (SearchResult mySearchResult in myDirectorySearcher.FindAll())
    {
    if (mySearchResult != null)
    {
    // Get the properties of the 'mySearchResult'.
    ResultPropertyCollection myResultPropColl;
    myResultPropColl = mySearchResult.Properties;
    Console.WriteLine("The properties of the 'mySearchResult' are :"); foreach (string myKey in myResultPropColl.PropertyNames)
    {
    string tab = "    ";
    Console.WriteLine(myKey + " = ");
    foreach (Object myCollection in myResultPropColl[myKey])
    {
    Console.WriteLine(tab + myCollection);
    }
    }
    mySearchRoot.Dispose();
    }
    }
      

  2.   

    这代码 一开始变量是string是都没写 我还解析呢 才看到字符串 加了个string
      

  3.   

    难搞,又不稳定
    我的解决方法是用.net输出webservice,然后java访问webservice
    .net读取ad输出webservice 就简单又稳定