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

推荐订阅源

S
Securelist
C
Cybersecurity and Infrastructure Security Agency CISA
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security Affairs
Hacker News: Ask HN
Hacker News: Ask HN
L
Lohrmann on Cybersecurity
PCI Perspectives
PCI Perspectives
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cyber Attacks, Cyber Crime and Cyber Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
MyScale Blog
MyScale Blog
月光博客
月光博客
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recorded Future
Recorded Future
The GitHub Blog
The GitHub Blog
Webroot Blog
Webroot Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
TaoSecurity Blog
TaoSecurity Blog
P
Proofpoint News Feed
Google DeepMind News
Google DeepMind News
F
Full Disclosure
U
Unit 42
Jina AI
Jina AI
博客园 - 司徒正美
阮一峰的网络日志
阮一峰的网络日志
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
大猫的无限游戏
大猫的无限游戏
The Hacker News
The Hacker News
The Last Watchdog
The Last Watchdog
T
Troy Hunt's Blog
腾讯CDC
T
Threatpost
H
Hacker News: Front Page
P
Palo Alto Networks Blog
博客园 - 聂微东
Last Week in AI
Last Week in AI
有赞技术团队
有赞技术团队
Help Net Security
Help Net Security
L
LINUX DO - 热门话题
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Spread Privacy
Spread Privacy

博客园 - eFeng.Leung

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 Lists all entries in the Active Directory Using Active Directory Active Directory and .NET 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里行的色
枚举Exchange Server、SotreGroups和MailStore
eFeng.Leung · 2007-03-26 · via 博客园 - eFeng.Leung

通过这段代码,结合创建 Mailbox 的代码,可以实现获取Exchange环境的Server、StoreGroup、MailStore和Mailbox信息,或在指定Store(比如在所有Store中最少Mailbox的那个,或者人为指定目标Store)中创建Mailbox。

protected void Page_Load(object sender, EventArgs e)

        
{

            DirectoryEntry RootDSE 
= new DirectoryEntry("LDAP://RootDSE");

            
string rootPath = "LDAP://" + RootDSE.Properties["configurationNamingContext"].Value.ToString();

            DirectoryEntry configContainer 
= new DirectoryEntry(rootPath);

 

            DirectorySearcher configSearcher 
= new DirectorySearcher(configContainer);

            configSearcher.SearchRoot 
= configContainer;

            configSearcher.Filter 
= "(objectCategory=msExchExchangeServer)";

 

            
// Enumerate all Exchange Servers

            SearchResultCollection serverResults 
= configSearcher.FindAll();

            
foreach (SearchResult serverResult in serverResults)

            
{

                Response.Write(
"<br/><br/><font color=\"red\">=== Exchange Server: " + serverResult.GetDirectoryEntry().Properties["cn"].Value.ToString() + " ===</font><br/><br/>");

 

                SearchResultCollection storeGroups;

                SearchResultCollection stores;

                
int mailboxCount;

 

                
// Enumerate all Store Groups

                storeGroups 
= SearchContainer(serverResult.Properties["distinguishedName"][0].ToString(),

                    
"(objectCategory=msExchStorageGroup)");

                
foreach (SearchResult storeGroup in storeGroups)

                
{

                    
string storeGroupName = storeGroup.GetDirectoryEntry().Properties["cn"].Value.ToString();

                    Response.Write(storeGroupName 
+ "<br/>");

 

                    mailboxCount 
= 0;

 

                    
// Enumerate All Stores

                    stores 
= SearchContainer(storeGroup.Properties["distinguishedName"][0].ToString(),

                        
"(objectCategory=msExchPrivateMDB)");

                    
foreach (SearchResult store in stores)

                    
{

                        Response.Write(
"&nbsp;&nbsp;" + store.GetDirectoryEntry().Properties["cn"].Value.ToString() + "<br/>");

                        Response.Write(
"&nbsp;&nbsp;&nbsp;&nbsp;Number of Mailboxes: " +

                            store.GetDirectoryEntry().Properties[
"homeMDBBL"].Count.ToString() + "<br/>");

 

                        mailboxCount 
+= store.GetDirectoryEntry().Properties["homeMDBBL"].Count;

                    }


 

                    
string reportMsg = String.Format("Total Number of Mailboxes in Storage Group({0}): {1}<br/><br/>", storeGroupName, mailboxCount);

                    Response.Write(reportMsg);

                }


            }


        }


 

        
private SearchResultCollection SearchContainer(string srvPath, string strFilter)

        
{

            
string ldapPath = "LDAP://" + srvPath;

            DirectoryEntry serverContainer 
= new DirectoryEntry(ldapPath);

 

            DirectorySearcher serverSearcher 
= new DirectorySearcher(serverContainer);

            serverSearcher.Filter 
= strFilter;

            serverSearcher.SearchScope 
= SearchScope.Subtree;

 

            serverSearcher.PropertiesToLoad.Add(
"cn");

            serverSearcher.PropertiesToLoad.Add(
"distinguishedName");

            serverSearcher.PropertiesToLoad.Add(
"homeMDBBL");

 

            SearchResultCollection results 
= serverSearcher.FindAll();

 

            
return results;

        }



     
关于Exchange的收藏夹几个必备站点: