我想搜索在林中所有域和我這樣做以下列方式:C#:如何使用DirectoryContext,Domains和DirectoryEntry類啓用SSL連接到Active Directory?
foreach(Domain currDomain in Forest.GetCurrentForest().Domains)
{
try
{
DirectorySearcher searcher = new
DirectorySearcher(currDomain.GetDirectoryEntry());
searcher.PageSize = 1000;
searcher.PropertiesToLoad.Add("cn");
searcher.PropertiesToLoad.Add("distinguishedName");
searcher.Filter = "(&(objectClass=group))";
using (SearchResultCollection resList = searcher.FindAll())
{
}
}
}
現在我想做的事與啓用SSL相同。要做到這一點,我試圖在的DirectoryEntry類
AuthenticationType
屬性設置爲
AuthenticationTypes.SecureSocketsLayer.
但是,當我嘗試執行,「的操作錯誤發生」異常被拋出。
有人可以幫助我嗎?