我在网站上搜索了信息,发现了这个:
ASP.NET C# 活动目录- 查看用户密码过期前的时间
,这解释了如何根据域策略获取密码过期时的值。
我的问题是:如果用户的 OU 组策略具有不同的 MaxPasswordAge 值,覆盖域组策略中指定的值,该怎么办?如何以编程方式获取 OU 的组策略对象?
编辑:为了使这个问题更清楚一点,我添加了此编辑。我所追求的是能够知道用户的密码何时过期。据我了解,日期值可以由域本地策略或组对象策略控制。我有一个 Linq2DirectoryService Provider,可以将 Linq 转换为 Ldap 查询。因此,获取日期到期值的 LDAP 查询对于该主题来说是最佳选择。如果您的答案包括 .net 支持的对象包装器包含在该等式中 - 这将是一个完美的答案!
I have searched the site for information and found this:
ASP.NET C# Active Directory - See how long before a user's password expires
which explains how to get the value of when the password expires as per Domain Policy.
My question is this: what if the user has an OU Group Policy that has a different MaxPasswordAge value, overriding the one specified in Domain Group Policy? How to programatically get the OU's Group Policy Object?
Edit: To make this question a little bit more clear, I am adding this edit. What I am after is to being able to tell when user's password expires. As far as I understand that date value can either be governed by domains local policy or by group object policy. I have a Linq2DirectoryService Provider that translates Linq to Ldap queries. So an LDAP query to get the date expiration value would be optimal for this subj. If you answer includes what objects wrappers supported by .net are included into this equation - it would be a dead on answer!
发布评论
评论(4)
让我从 http://support.microsoft.com/kb/323750 开始,其中包含 Visual Basic和 VBScript 示例以及 http://www.anitkb.com /2010/03/how-to-implement-active-directory.html 其中概述了 maxPwdAge OU 设置如何影响计算机而不是用户。它还具有指向 AloInfo.exe 作为 MS 的一个工具,可用于获取密码期限。
这是示例:
Let me start with http://support.microsoft.com/kb/323750 which contains Visual Basic and VBScript examples and http://www.anitkb.com/2010/03/how-to-implement-active-directory.html which outlines how the maxPwdAge OU setting impacts computers, not users. It also has a comment pointing to AloInfo.exe as a tool from MS that can be used to get password ages.
Here is the example:
以下代码可帮助我获取域和本地用户帐户的密码到期日期:
The following code worked for me to get the password expiration date on both domain and local user accounts:
使用以下方法获取帐户的到期日期 -
Use following method to get expiration date of the account-
以前的一些答案依赖于 DirectoryEntry.InvokeGet 方法,MS 认为不应使用。因此,这里有另一种方法:
您需要添加对 ActiveDS COM 库的引用,该库通常位于 C:\Windows\System32\activeds.tlb。
Some of the previous answers rely on the DirectoryEntry.InvokeGet method, which MS says should not be used. So here's another approach:
You'll need to add a reference to the ActiveDS COM library typically found at C:\Windows\System32\activeds.tlb.