Active Directory 常用属性
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.htm4.权限码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;pwdLastSetbadPwdCount 用户尝试错误密码的次数
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 常用属性的更多相关文章
- Active Directory的DirectoryEntry与DirectorySearcher初识及Filter语法
前言 增删改查,我想查询是最先要说的一个了.本章主要记录使用.NET Framework进行对域控服务器对象的查询操作,介绍DirectoryEntry与DirectorySearcher(搜索器)及 ...
- Active Directory的LDAP协议与DN(Distinguished Name)详解
前言 光copy几段代码的文章没什么意思,本章上最基础的代码,主要是为了从编程方面聊LDAP和DN,其它的后面聊,一步步慢慢来吧. Active Directory编程须知 1.域控服务器: Wind ...
- C# AD(Active Directory)域信息同步,组织单位、用户等信息查询
示例准备 打开上一篇文章配置好的AD域控制器 开始菜单-->管理工具-->Active Directory 用户和计算机 新建组织单位和用户 新建层次关系如下: 知识了解 我们要用C# ...
- DNS笔记 DNS区域集成到 Active Directory
可以将 DNS 区域集成到 Active Directory 中以提供增强的容错功能和安全性.OpenDNS Google Public DNS往返时间 (RTT) 远程访问服务 (RAS)域名与 ...
- C#操作Active Directory(AD)详解
1. LDAP简介 LDAP(轻量级目录访问协议,Lightweight Directory Access Protocol)是实现提供被称为目录服务的信息服务.目录服务是一种特殊的数据库系统,其专门 ...
- 超越LLMNR /NBNS欺骗 - 利用Active Directory集成的DNS
利用名称解析协议中的缺陷进行内网渗透是执行中间人(MITM)攻击的常用技术.有两个特别容易受到攻击的名称解析协议分别是链路本地多播名称解析(LLMNR)和NetBIOS名称服务(NBNS).攻击者可以 ...
- 【转】Spring Boot干货系列:常用属性汇总
转自Spring Boot干货系列:常用属性汇总 附录A.常用应用程序属性 摘自:http://docs.spring.io/spring-boot/docs/current/reference/ht ...
- Active Directory的基本概念
前言 本文是面对准备加入Active Directory编程的初学者的一份文章,主要是讲解Active Directory(活动目录)的一些概念和相关知识.这篇文章本来是不想写下来的,因为概念性内容的 ...
- Active Directory组织单位(Organizational Unit)操作汇总
前言 本章聊Active Directory的组织单位(OU)的新增.修改.移动等操作,使用.NET Framework 为我们提供的System.DirectoryServices程序集. 不积跬步 ...
随机推荐
- go 函数定义
-------------------------------------------- package main import "fmt" func add(x int, y i ...
- Python开发【第三章】:函数介绍
一. 函数介绍 1.函数是什么? 在学习函数之前,一直遵循面向过程编程,即根据业务逻辑从上到下实现功能,其往往用一长段代码来实现指定功能,开发过程中最常见的操作就是粘贴复制,也就是将之前实现的代码块复 ...
- Mysql slave 延迟故障一列(无主键)
首先还是给出我见过的一些延迟可能: 大事物延迟 延迟略为2*执行时间 状态为:reading event from the relay log 大表DDL延迟 延迟略为1*执行时间 状态为:alter ...
- Asp.net core 学习笔记 ( ef core transaction scope & change level )
ef core 有 unit of work 的概念,当我们 save change 时会自动使用 transaction 确保更新的一致性. 隔离级别是默认的 read committed 不允许脏 ...
- DP动态规划学习笔记——高级篇上
说了要肝的怎么能咕咕咕呢? 不了解DP或者想从基础开始学习DP的请移步上一篇博客:DP动态规划学习笔记 这一篇博客我们将分为上中下三篇(这样就不用咕咕咕了...),上篇是较难一些树形DP,中篇则是数位 ...
- sping+redis实现消息队列的乱码问题
使用spring支持redis实现消息队列,参考官方样例:https://spring.io/guides/gs/messaging-redis/ 实现后在运行过程中发现消费者在接收消息时会出现乱码的 ...
- (九)Struts标签基础(二)
2.3 非表单标签 2.3.1 <s:actionerror>标签, this.addActionError("错误信息1"); //使用addActionErro ...
- UnityC#中修改RectTransform
1.改变RectTransform的Left和Buttom GetComponent<RectTransform>().offsetMax = new Vector2(left, top) ...
- EF中DbContext的生命周期
/// <summary>/// 依赖注入系统中类的生命周期./// </summary>public enum DependencyLifeStyle{ /// < ...
- CVE-2019-0214: Apache Archiva arbitrary file write and delete on the server
CVE-2019-0214: Apache Archiva arbitrary file write and delete on the server Severity: Medium Vendor: ...