1.获取DirectoryEntry

string str = string.Empty;
string strPath = @LDAP://testDomain.com.mo;
string ad = "testAD";
System.DirectoryServices.DirectorySearcher sea = new System.DirectoryServices.DirectorySearcher(strPath);
sea.Filter = "(&(objectCategory=user)(sAMAccountName=" + ad + "))";
System.DirectoryServices.SearchResult res = sea.FindOne();
System.DirectoryServices.DirectoryEntry d = new System.DirectoryServices.DirectoryEntry();
d.Path = res.Path;
foreach (string p in d.Properties.PropertyNames)
{
     str += string.Format("{0}:{1}\r\n",p , d.Properties[p].Value.ToString());
} 2.基本信息name,givenName.distinguishedName,displayName,mailNickname
http://tech.ddvip.com/2013-01/1358156532188866.html 3.定位信息
sAMAccountName:ad
sAMAccountType:805306368 all user objects
"(sAMAccountType=805306368)"
"(&(objectCategory=person)(objectClass=user)(cn=Joe*))"
"(&(objectCategory=group)(|(cn=Test*)(cn=Admin*)))" ADO Search Tips
http://www.rlmueller.net/ADOSearchTips.htm
4.权限码userAccountControl启用512,禁用514,密码永不过期66048
enable:
	d.Properties["userAccountControl"].Value = 512 & ~0x2;
	user.CommitChanges();
disable:
d.Properties["userAccountControl"].Value = 512 | 0x2;
unlock:
	d.Properties["LockOutTime"].Value = 0;
reset password:
d.Invoke("SetPassword", new object[] { password });
        d.Properties["LockOutTime"].Value = 0; 
d.Properties["pwdLastSet"].Value = 0;
pwdLastSet

badPwdCount 用户尝试错误密码的次数
badPasswordTime 用户最后一次尝试错误密码的时间
lastLogon 用户最后登陆时间
accountExpires 帐户到期日期

Constant Hexadecimal value Decimal value
ADS_UF_NORMAL_ACCOUNT 0x200 512
ADS_UF_ACCOUNTDISABLE 0x0002 2
ADS_PASSWD_NOTREQD 0x0020 3
PASSWORD_EXPIRED 512 | 0x800000
http://blog.sina.com.cn/s/blog_6d6712230100ls0v.html

5.adsiedit.msc
http://www.cnblogs.com/dragonwlb/archive/2012/08/06/2625474.html

Active Directory 常用属性的更多相关文章

  1. Active Directory的DirectoryEntry与DirectorySearcher初识及Filter语法

    前言 增删改查,我想查询是最先要说的一个了.本章主要记录使用.NET Framework进行对域控服务器对象的查询操作,介绍DirectoryEntry与DirectorySearcher(搜索器)及 ...

  2. Active Directory的LDAP协议与DN(Distinguished Name)详解

    前言 光copy几段代码的文章没什么意思,本章上最基础的代码,主要是为了从编程方面聊LDAP和DN,其它的后面聊,一步步慢慢来吧. Active Directory编程须知 1.域控服务器: Wind ...

  3. C# AD(Active Directory)域信息同步,组织单位、用户等信息查询

    示例准备 打开上一篇文章配置好的AD域控制器 开始菜单-->管理工具-->Active Directory 用户和计算机 新建组织单位和用户   新建层次关系如下: 知识了解 我们要用C# ...

  4. DNS笔记 DNS区域集成到 Active Directory

    可以将 DNS 区域集成到 Active Directory 中以提供增强的容错功能和安全性.OpenDNS   Google Public DNS往返时间 (RTT) 远程访问服务 (RAS)域名与 ...

  5. C#操作Active Directory(AD)详解

    1. LDAP简介 LDAP(轻量级目录访问协议,Lightweight Directory Access Protocol)是实现提供被称为目录服务的信息服务.目录服务是一种特殊的数据库系统,其专门 ...

  6. 超越LLMNR /NBNS欺骗 - 利用Active Directory集成的DNS

    利用名称解析协议中的缺陷进行内网渗透是执行中间人(MITM)攻击的常用技术.有两个特别容易受到攻击的名称解析协议分别是链路本地多播名称解析(LLMNR)和NetBIOS名称服务(NBNS).攻击者可以 ...

  7. 【转】Spring Boot干货系列:常用属性汇总

    转自Spring Boot干货系列:常用属性汇总 附录A.常用应用程序属性 摘自:http://docs.spring.io/spring-boot/docs/current/reference/ht ...

  8. Active Directory的基本概念

    前言 本文是面对准备加入Active Directory编程的初学者的一份文章,主要是讲解Active Directory(活动目录)的一些概念和相关知识.这篇文章本来是不想写下来的,因为概念性内容的 ...

  9. Active Directory组织单位(Organizational Unit)操作汇总

    前言 本章聊Active Directory的组织单位(OU)的新增.修改.移动等操作,使用.NET Framework 为我们提供的System.DirectoryServices程序集. 不积跬步 ...

随机推荐

  1. C# LoadXml System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.

    去掉BOM头 writer = new XmlTextWriter(stream, new UnicodeEncoding(false,false)); 如果是UTF8 writer = new Xm ...

  2. (七)easyUI之Accordion折叠面板:普通的静态面板

    一.普通的静态面板 前台 <%@ page language="java" contentType="text/html; charset=UTF-8" ...

  3. Nginx实现同一端口HTTP跳转HTTPS

    小目标:在只监听一个端口的情况下,将http访问跳转为https. 一般情况下http协议使用80端口,https协议443端口.要实现http强制转https是非常简单的事,随便都可以找到很多方案. ...

  4. Linux Centos7配置ftp服务器

    一.安装 1.安装 yum install  -y vsftpd 2.设置开机启动 systemctl enable vsftpd.service 3.启动 systemctl start vsftp ...

  5. Java 面向对象(一)面向对象思想

    一.面向对象思想 1.概述 Java语言是一种面向对象的程序设计语言,而面向对象思想是一种程序设计思想,我们在面向对象思想的指引下,使用Java语言去设计.开发计算机程序. 这里的对象泛指现实中一切事 ...

  6. Xcode8 1 创建coreData的ManagedObject后,报错 linker command failed with exit code 1

    Xcode8 1 创建coreData的ManagedObject后,报错 使用Xcode 8.1 创建coreData的ManagedObject后,报错. duplicate symbol OBJ ...

  7. openpyxl 设置单元格颜色

    在处理excel数据格式的时候,需要对特定单元格进行颜色标注,方便相关人员查看 醒目 # -*- coding: utf-8 -*- from openpyxl import load_workboo ...

  8. Qemu: User mode emulation and Full system emulation

    转载: https://wiki.edubuntu.org/UbuntuDevelopment/Ports QEMU QEMU is a processor emulator and supports ...

  9. C++——namespace

    scope和namespace scope就是我们常说的作用域,namespace是C++引入的一个关键字.这两种都和作用域有些微妙的联系,下面 引自Global scope vs global na ...

  10. linux内核驱动学习指南

    1. 参考链接 小白的博客 ONE_Tech 你为什么看不懂Linux内核驱动源码? 求教怎么学习linux内核驱动