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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - eFeng.Leung

枚举Exchange Server、SotreGroups和MailStore Single Sign-On for everyone 关于AD编程的一些资料 zz 不同的asp.net web应用程序间共享Session/Application - eFeng.Leung - 博客园 Code Project中几篇关于DNN的文章 Authenticate a user against the Active Directory using the user ID and password User Object User Interface Mapping Using Active Directory Active Directory and .NET - eFeng.Leung LDAP, IIS and WinNT Directory Services 无法破解的软件注册码算法 SQL2K集群 绑定在 TCP 端口 1433 上失败 使用HTTP访问2003表单登录页 (转) FYI: Getting Started with WebDAV 遭遇 对路径“C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\aa\……”的访问被拒绝 - eFeng.Leung 网络负载平衡部署 Group Panel 在DataGrid里显示Excel文件数据 鼠标移动,改变datagrid里行的色
Lists all entries in the Active Directory
eFeng.Leung · 2006-04-04 · via 博客园 - eFeng.Leung

Active Directory Sample I
By  John O Donnell August 23, 2001

This sample shows how to access Active Directory information in a Windows 2000 domain.

My test network consists of a Windows 2000 domain controller and a Windows 2000 server. When you install a Windows 2000 domain controller and are creating a new domain you install both the active directory and DNS which the active directory uses. The Active Directory in Windows 2000 allows you to store information about servers, printers, users etc.

So finally I thought yeah very nice, wonder if I can run code from my server to access the directory information. Below is the code which lists all the entries in my small active Directory. Note my domain is called Microsoft for testing purposes.

Source Code:

// Active Directory Sample 1
// Lists all entries in the Active Directory for Domain microsoft.
using System;
using System.DirectoryServices; 
namespace ActiveDirectory

/// <summary>
/// Summary description for Class1.
/// </summary> 

class Class1
{
static void Main (string[] args)
{
//Note : microsoft is the name of my domain for testing purposes.
DirectoryEntry entry = new DirectoryEntry(LDAP://microsoft);
System.DirectoryServices.DirectorySearcher mySearcher = new System.DirectoryServices.DirectorySearcher(entry);
mySearcher.Filter 
= ("(objectClass=*)");
Console.WriteLine(
"Active Directory Information"); 
Console.WriteLine(
"==========================================="); 
foreach(System.DirectoryServices.SearchResult resEnt in mySearcher.FindAll())
{
Console.WriteLine( resEnt.GetDirectoryEntry().Name.ToString() );
Console.WriteLine( resEnt.GetDirectoryEntry().Path.ToString() );
Console.WriteLine( resEnt.GetDirectoryEntry().NativeGuid.ToString() );
Console.WriteLine(
"==========================================="); 
}

}

}

}