惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Exploit Database - CXSecurity.com
A
Arctic Wolf
K
Kaspersky official blog
T
Threat Research - Cisco Blogs
PCI Perspectives
PCI Perspectives
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy & Cybersecurity Law Blog
O
OpenAI News
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
Cisco Blogs
AWS News Blog
AWS News Blog
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
美团技术团队
T
Threatpost
S
Schneier on Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Cyber Attacks, Cyber Crime and Cyber Security
Last Week in AI
Last Week in AI
C
CERT Recently Published Vulnerability Notes
Blog — PlanetScale
Blog — PlanetScale
C
Cybersecurity and Infrastructure Security Agency CISA
F
Full Disclosure
博客园_首页
N
Netflix TechBlog - Medium
Security Latest
Security Latest
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Register - Security
The Register - Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Recent Announcements
Recent Announcements
博客园 - Franky
P
Palo Alto Networks Blog
Project Zero
Project Zero
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
H
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Cisco Talos Blog
Cisco Talos Blog
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 【当耐特】
GbyAI
GbyAI

博客园 - Samgle

HttpRequest重写,解决资源占用/链接超时/分块下载事件通知 问题。 PDF-XChange 3.0 / Pro4.0注册码 Welcome to the Live Labs Pivot Technical Preview 修复 VS2008 asp.net 设计视图 失效/工具-选项[Html设计视图]出现"加载此属性页时出错" 方案 对于JavaScript的 Stack overflow at line 错误总结 - Samgle 10 Free Chart Scripts 如何让mvc运行在IIS6.0上? (ASP.NET MVC on IIS 6 Walkthrough) Live.com MSN 在线状态查询接口(JSON数据输出) - Samgle BIND9.5b1 for windows 2003 Google Maps by asp.net API集成-S.Sams Olympic Medal 如何在asp.net中用jQuery实现便捷的提示功能和表单验证功能-S.Sams jQuery jGrow 改进版 通过代理访问 http://sourceforge.net/ 常用简易JavaScript函数 世界真細小 (原曲: It's A Small World), 作曲: Richard She 做下笔记, Response 文件流类型 推荐微软官方Windows Server 2008实战攻略系列下载 Most used CSS tricks
解决删除域用户Exception from HRESULT: 0x80072030
Samgle · 2013-11-27 · via 博客园 - Samgle

解决删除域用户异常问题。


System.DirectoryServices.DirectoryServicesCOMException was unhandled
  Message=在服务器上没有这样一个对象。 (Exception from HRESULT: 0x80072030)
  Source=System.DirectoryServices
  ErrorCode=-2147016656
  ExtendedError=8333
  ExtendedErrorMessage=0000208D: NameErr: DSID-031001CD, problem 2001 (NO_OBJECT), data 0, best match of:
    'CN=Users,DC=samshum,DC=com'

解决方案代码:

        private const string AdPath= "LDAP://192.168.8.151";
        private const string AdUser= "administrator";
        private const string AdPassWord= "1231112123";

        /// <summary>
        /// 删除指定用户
        /// </summary>
        /// <param name="sAMAccountName"></param>
        public void DeleteUserByAccount(string sAMAccountName)
        {
            GetCommonName(sAMAccountName);
        }

        /// <summary>
        /// 删除指定用户,通过用户全称
        /// </summary>
        /// <param name="NickName"></param>
        public void DeleteUserByNickName(string NickName)
        {
            using (DirectoryEntry entry = new DirectoryEntry(ADPath, ADUser, ADPassword))
            {
                using (DirectorySearcher Search = new DirectorySearcher())
                {
                    Search.SearchRoot = entry;
                    Search.Filter = "(&(objectClass=user) (cn=" + NickName + "))";
                    SearchResult Result = Search.FindOne();
                    using (DirectoryEntry child = Result.GetDirectoryEntry())
                    {
                        child.DeleteTree();
                        child.Close();
                        child.Dispose();
                    }
                    Search.Dispose();
                }
                entry.Close();
                entry.Dispose();
            }
        }