General discussion


Script To Unexpire Password

By smartdude ·
I am looking for a script which can put a checkmark in account options for the password never expires.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Modify the userAccountControl

by faradhi In reply to Script To Unexpire Passwo ...

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.;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://<<Insert Distinguished Name of the user>>")' & oRoot.Get("DefaultNamingContext"))
oObject.userAccountControl = <<insert desired userAccountControl value>>

Collapse -

by rocky5689 In reply to Script To Unexpire Passwo ...

Is there way that the script can pull users name from a OU ??

Collapse -

Yes, It takes bit more

by faradhi In reply to

Set oRoot = GetObject("LDAP://rootDSE")
Set oDomain = GetObject("<Distinguished name of the OU>")' & oRoot.Get("DefaultNamingContext"))
oDomain.Filter = Array("user")
For Each object In oDomain
object.userAccountControl = <value>

Related Discussions

Related Forums