如何使用 ADAM 使密码过期

发布于 2024-08-26 07:55:42 字数 186 浏览 3 评论 0原文

我们正在使用 ADAM 在我们的开发环境中模拟 AD 服务器。我们需要使几个用户的密码过期,以测试几个关键代码路径。

我们一直通过将密码到期窗口设置为较低(1 天),然后等待该间隔直到密码到期来实现此目的。然而,这很慢,一旦我们更改密码,我们必须再等待一天才能看到另一个到期窗口。

有没有人有一个简单的解决方案来解决这个问题?

We are using ADAM to simulate an AD server in our development environment. We need to expire passwords for a couple of our users to test several key code paths.

We have been doing this by setting the password expiry window low (1 day) and then waiting that interval until the password expires. However, this is slow and once we change the password we must wait another day for anothe expiry window.

Does anyone have an easy solution to this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烧了回忆取暖 2024-09-02 07:55:42

您可以通过在用户属性中将 pwdExpiryInterval 设置为 0 来使密码过期。

You can expire password by setting pwdExpiryInterval to 0 in the user's properties.

苦笑流年记忆 2024-09-02 07:55:42

我很久以后才想到这个问题,并想找到更直接的答案。经过一番研究,我发现了两个:

  1. 如果您使用程序集System.DirectoryServices.AccountManagement并且您有一个UserPrincipal,您可以使用myUser.ExpirePasswordNow( )

  2. 如果您使用程序集System.DirectoryServices并且您有一个DirectoryEntry,您可以myEntry.Properties["pwdLastSet"].Value = 0 code>。

我会有点担心按照之前的建议使用 pwdExpiryInterval 因为可能会有副作用(尽管对于OP所述的情况可能没问题)。

I happened on this question much later and wanted to find a more direct answer. After some research I found two:

  1. If you're using assembly System.DirectoryServices.AccountManagement and you have a UserPrincipal you can use myUser.ExpirePasswordNow().

  2. If you're using assembly System.DirectoryServices and you have a DirectoryEntry you can myEntry.Properties["pwdLastSet"].Value = 0.

I'd be a little concerned about using pwdExpiryInterval as suggested before because there might be side effects (although for the OP's stated case it's probably fine).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文