Re: How to Modify Password Expire date for AD User account



Hi,

There is no way to set the password expiration date.

The pwdLastSet attribute of the user object represents the date the password
was last set. The maxPwdAge attribute of the domain object represents how
long passwords can age before they expire. maxPwdAge applies to all user
objects in the domain. The userAcccountControl attribute of the user object
has bits that indicate if the password expires for that user, and if the
password can change. The domain password age policy only applies if the
password can change and expires.

The problem is that you cannot assign values to pwdLastSet, except 0 and -1.
Assigning 0 to pwdLastSet expires the password so the user must change it
the next time they logon. Assigning -1 resets this requirement, so the user
does not have to change their password the next time they logon. When the
user next logs on, pwdLastSet is changed to a value corresponding to the
current date/time, so the password will expire according to the domain
policy (maxPwdAge).

The best you can do is expire the password immediately, or have it expire
maxPwdAge time after the next logon.

What are you trying to accomplish by assigning a password expiration date?
Maybe someone knows of a workaround.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net

"B" <B@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:303CF80A-058A-4C27-9086-1CA00CC6AB2D@xxxxxxxxxxxxxxxx
Thank you very much for your reply. I am looking for the Password Expire
Date, not Account expire date. Does anybody help me? Sincerely,

"Richard Mueller" wrote:

Hi,

It should be:

objUser.AccountExpirationDate = #03/30/2005#
objUser.SetInfo

Date literals are enclosed in # symbols and this property method deals
with
date datatypes.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net

"B" <B@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:EB554B1F-31D7-4968-9D40-4FC81CAF9417@xxxxxxxxxxxxxxxx
Freddy,
It did not work. I did not get any message after running this script.
I
thought, it worked, but it did not. Expire date was the same.

"freddy" wrote:

Try this script

Set objUser = GetObject _
("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com";)

objUser.AccountExpirationDate = "03/30/2005"
objUser.SetInfo


"B" wrote:

I would like to know how to modify Password Expire date for AD User
account
by scripting. Can anybody help me? Thank you,





.



Relevant Pages

  • Re: Staggered Password Changes within OU
    ... A problem is that you must set the maxPwdAge for the domain, ... expire the password for 25 users. ... set pwdLastSet to 0 only if it is older than some value, ... Is there any method available to stagger password changes for users ...
    (microsoft.public.windows.server.active_directory)
  • Re: Force password Expiration to 5 days
    ... The only value you can assign to pwdLastSet is 0. ... ' Expire the password. ... You can use ADO in a VBScript program to retrieve the Distinguished Names ...
    (microsoft.public.windows.server.scripting)
  • Re: Password aging
    ... It seems like the pwdLastSet value should be a bunch of code rather than something meaningful? ... Co-author of "The .NET Developer's Guide to Directory Services ... not everyone will expire the same time. ... Your password change policy will take effect once the password has aged out and yes the local never expires will over for your service accounts. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Force password expiry?
    ... Select users defined within a specific OU and expire their passwords ... Task 2 can use ADO to retrieve users where the userAccountControl attribute ... each user object with the retrieved distinguishedName, ... Set objConnection = CreateObject ...
    (microsoft.public.win2000.active_directory)
  • Re: Add multiple local user accounts
    ... user accounts to a PC and set their passwords to never expire. ... The trick is you must use the WinNT provider for local accounts. ... ' Bind to the local computer object. ... ' Create local user object. ...
    (microsoft.public.scripting.vbscript)