Discussion Locked

Script To Unexpire Password

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am looking for a script which can put a checkmark in account options for the password never expires.

3 replies

by faradhi

The userAccountControl is an integer value stored in AD that is the sum of the values of each checkbox within the "Account Options" box of the Account tab in the User properties. The easiest way to get the correct value is to set a user how you want the script to set the user and then use ASDI Edit to view the value. You can also use the following link which explains how this works. http://support.microsoft.com/default.aspx?scid=kb;en-us;Q305144

This is a sample VB Script you will need to modify to fit your domain.

Set oRoot = GetObject("LDAP://rootDSE")
Set oObject = GetObject("LDAP://<>")' & oRoot.Get("DefaultNamingContext"))
oObject.userAccountControl = <>
oObject.setinfo

by faradhi

Set oRoot = GetObject("LDAP://rootDSE")
Set oDomain = GetObject("")' & oRoot.Get("DefaultNamingContext"))
oDomain.Filter = Array("user")
For Each object In oDomain
object.userAccountControl =
object.setinfo
Next

This discussion is closed to new replies.