我知道,我們可以得到這樣一個DirectoryEntry:如何使用objectGUID獲取DirectoryEntry?
string conPath = "LDAP://10.0.0.6/DC=wds,DC=gaga,DC=com";
string conUser = "administrator";
string conPwd = "Iampassword";
DirectoryEntry de = new DirectoryEntry(conPath, conUser, conPwd, AuthenticationTypes.Secure);
,我們可以這樣修改用戶的密碼:
DirectorySearcher deSearch = new DirectorySearcher();
deSearch.SearchRoot = de;
deSearch.Filter = String.Format("sAMAccountName={0}", "xumai");
SearchResultCollection results = deSearch.FindAll();
foreach (SearchResult objResult in results)
{
DirectoryEntry obj = objResult.GetDirectoryEntry();
obj.Invoke("setPassword", new object[] { "Welcome99" });
obj.CommitChanges();
}
如果使用
string x = obj.Guid.ToString();;
我們可以得到user's objectGUID「0b118130-2a6f-48d0-9b66-c12a0c71d892」
怎麼可以我改變它是基於這個objectGUID的密碼?
如何搜索這個objectGUID形式的用戶羣「LDAP://10.0.0.6/DC=wds,DC=gaga,DC=com」?
有什麼方法可以過濾嗎? etc「strFilter =」(&(objectGUID = 0b118130-2a6f-48d0-9b66-c12a0c71d892))「;
希望對您有所幫助
謝謝。
它很好用,謝謝! – cciikk