AD域 技術整理
来源:互联网 发布:药品数据库 编辑:程序博客网 时间:2024/06/12 22:53
AD域技术整理 C#
AD域路径为:LDAP://ad.XXXX.com.tw
AD域的类命名空间为:System.DirectoryServices
DirectoryEntry entry;
entry = new DirectoryEntry(path, AD域账户, AD域密码);
DirectorySearcher searcher = new DirectorySearcher(entry);
searcher.Filter = "(&(objectCategory=person)(objectClass=user)(!sAMAccountName=Exchang*))"; //获取AD域下 Exchange除外的所有用户信息
searcher.PageSize = 1000;
searcher.PropertiesToLoad.Clear();
SearchResultCollection src = searcher.FindAll();
int listCount = src.Count;
List<ADUsersEntity> list = new List<ADUsersEntity>(listCount);
if(listCount >0)
{
foreach (SearchResult rs in src)
{
if (rs != null)
{
string n = (rs.GetDirectoryEntry().Properties["distinguishedName"].Value == null) ? string.Empty : rs.GetDirectoryEntry().Properties["distinguishedName"].Value.ToString();
//AD域账户
string ADid= (rs.GetDirectoryEntry().Properties["sAMAccountName"].Value == null) ? string.Empty : rs.GetDirectoryEntry().Properties["sAMAccountName"].Value.ToString();
//英文名称
string ENName = (rs.GetDirectoryEntry().Properties["name"].Value == null) ? string.Empty : rs.GetDirectoryEntry().Properties["name"].Value.ToString();
string DisplayName = (rs.GetDirectoryEntry().Properties["displayName"].Value == null) ? string.Empty : rs.GetDirectoryEntry().Properties["displayName"].Value.ToString();
//用户中文名
string describe = (rs.GetDirectoryEntry().Properties["description"].Value == null) ? string.Empty : rs.GetDirectoryEntry().Properties["description"].Value.ToString();
string title = (rs.GetDirectoryEntry().Properties["title"].Value == null) ? string.Empty : rs.GetDirectoryEntry().Properties["title"].Value.ToString();
//部门名称
string depmentName = (rs.GetDirectoryEntry().Properties["Department"].Value == null) ? string.Empty : rs.GetDirectoryEntry().Properties["Department"].Value.ToString();
}
}
}
- AD域 技術整理
- Windows AD域用户属性对照表(综合整理)
- 整理的AD/2000技巧
- AD域
- 关于AD操作的资料之整理
- AD 实战之七:脱机碎片整理
- STM32处理器的AD难点整理
- AD转换设计中的基本问题整理
- AD转换设计中的基本问题整理
- AD转换设计中的基本问题整理
- AD属性对照表[AD域][DirectoryEntry]
- 什么是AD域控制器
- AD域的基本概念
- AD域filter
- AD域批量增加
- AD域管理
- AD域信息修改
- java连接AD域
- Oracle高级编程
- JS常见异常类型以及捕获异常
- 说说iOS与内存管理(上)
- 从此SQLPLUS有了Top命令
- Storm 配置图文解析
- AD域 技術整理
- 谁才是最快的消息队列:ActiveMQ, RabbitMQ, HornetQ, QPID
- uc/os-ii任务与任务管理
- LeetCode_71---Simplify Path
- leetcode[28]:Implement strStr()
- apt在线/离线安装CDH5.1.2
- 辛星浅析php正则匹配中的utf字符串
- MYSQL学习2数据库-表-字段
- MCU GPIO模拟spi