簡體   English   中英

查詢用戶是否在Active Directory中選中了“無法更改密碼”

[英]Query if user has “Cannot change password” checked in Active Directory

我正在嘗試為正在開發的應用檢查此信息...

我正在嘗試查詢userAccountControl,但是我發現如果設置了AD,它將無法正確更新。

這是我當前搜索UserAccountControl的方式

 If (res.Properties.Contains("userAccountControl")) Then
            userAccountControl = doespasswordexpire(res.Properties("userAccountControl").Item(0))
            userAccountControlPNR = PasswordNotRequired(res.Properties("userAccountControl").Item(0))
            userAccountControlSCR = SmartCardRequired(res.Properties("userAccountControl").Item(0))
        Else
            userAccountControl = ""
            userAccountControlPNR = ""
            userAccountControlSCR = ""
 End If

如何在ADSI或LDAP中執行此操作? 我不想使用PrincipalContext。

您不能使用userAccountControl屬性來修改甚至查詢“無法更改密碼”設置。 它在Microsoft文檔中被列為可能的標記,但是它不起作用(不確定是否曾經打算這樣做)。

要檢查是否已設置,您必須在用戶的DACL中解析出用戶的ACE。 您可以從用戶的ntSecurityDescriptor屬性中獲取該信息,並以編程方式對其進行解析。 該線程中有一個很好的起始示例。

一些其他的MSDN信息在這里: https : //msdn.microsoft.com/en-us/library/aa746398.aspx

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM