zoukankan      html  css  js  c++  java
  • 【域控】获取域控用户

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.DirectoryServices;
    
    namespace Domain
    {
        public class DirectoryActive 
        {
            private void GetUser()
            {
                string path;
                path = "LDAP://OU=Users,OU=Beijing,OU=****,DC=**,DC=corp";
                
                List<string> userList = new List<string>();
    
                DirectoryEntry ent = new DirectoryEntry(path);
                foreach (DirectoryEntry child in ent.Children)
                {
                    foreach (DirectoryEntry child1 in child.Children)
                    {
                        if (child1.Properties["displayname"].Value != null && child1.Properties["mailNickname"].Value != null)
                        {
                            string user = String.Format("{1}:{0}", child1.Properties["displayname"].Value.ToString(), child1.Properties["mailNickname"].Value.ToString());
                            userList.Add(user);
                        }
                    }
                }
                foreach (string str in userList)
                {
                    Console.WriteLine(str);
                }
                
            }
        }
    }
  • 相关阅读:
    CF 319C
    日常---区域赛临近
    poj 3728 The merchant 倍增lca求dp
    zoj 3742 Delivery 好题
    zoj 3717 Balloon 2-sat
    CF 163E. e-Government ac自动机+fail树+树状数组
    CF 335B
    hdu 4739 状压DP
    hdu 4738 桥
    Hibernate中的继承映射
  • 原文地址:https://www.cnblogs.com/viewcozy/p/4688283.html
Copyright © 2011-2022 走看看