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?

yamspog
  • 18,173
  • 17
  • 63
  • 95

2 Answers2

0

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

yamspog
  • 18,173
  • 17
  • 63
  • 95
0

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).

pettys
  • 2,293
  • 26
  • 38