Uncheck "password never expires"

M

Mary

Is there a script that will 'uncheck' the password never expires box for a
group of accounts? I have the ADModify tool, but it didn't uncheck the box
once it was checked. (I ran it once to make sure the box was checked on a
group of accounts, then ran it again with the box unchecked, but it didn't
make any changes). Thanks
 
T

Tomasz Onyszko

Mary said:
Is there a script that will 'uncheck' the password never expires box for a
group of accounts? I have the ADModify tool, but it didn't uncheck the box
once it was checked. (I ran it once to make sure the box was checked on a
group of accounts, then ran it again with the box unchecked, but it didn't
make any changes). Thanks

You should modify userAccountControl attribute value. Here You will find
example how to modify this value:
http://www.rallenhome.com/books/winsckbk/src/16-09-set_acct_options.vbs.txt

And here You will find value You need to set for your accounts:
http://www.microsoft.com/technet/scriptcenter/guide/sas_usr_vrbt.mspx
 
J

Jerold Schulman

Is there a script that will 'uncheck' the password never expires box for a
group of accounts? I have the ADModify tool, but it didn't uncheck the box
once it was checked. (I ran it once to make sure the box was checked on a
group of accounts, then ran it again with the box unchecked, but it didn't
make any changes). Thanks
See the following tips in the 'Tips & Tricks' at http://www.jsifaq.com

9625 » How can a batch set a user's UserAccountControl attribute for 'Password never expires' on or off?

9626 » How can I set 'all' user's UserAccountControl attribute for 'Password never expires' on or off?
 
J

Jorge_de_Almeida_Pinto

Is there a script that will 'uncheck' the password never
expires box for a
group of accounts? I have the ADModify tool, but it didn't
uncheck the box
once it was checked. (I ran it once to make sure the box was
checked on a
group of accounts, then ran it again with the box unchecked,
but it didn't
make any changes). Thanks

Use the following script code as an example to create your own


If xACCNTPwdNoExp = "" Then
Else
xACCNTControlORG = xobjACCNTdn.Get("userAccountControl")
xACCNTControlBIT = 65536
If Lcase(xACCNTPwdNoExp) = "UNCHECKED" Then
xboolEnable = False
End If
If Lcase(xACCNTPwdNoExp) = "CHECKED" Then
xboolEnable = True
End If
xACCNTControlCALC = xCalcBitFlags(xACCNTControlORG, xACCNTControlBIT,
xboolEnable)
If xACCNTControlORG <> xACCNTControlCALC Then
xobjACCNTdn.Put "userAccountControl", xACCNTControlCALC
End If
End If

Function xCalcBitFlags(xACCNTControlORG, xACCNTControlBIT,
xboolEnable)
xCalcBitFlags = xACCNTControlORG
If xboolEnable = TRUE Then
xCalcBitFlags = xACCNTControlORG Or xACCNTControlBIT
Else
If xACCNTControlORG And xACCNTControlBIT Then
xCalcBitFlags = xACCNTControlORG Xor xACCNTControlBIT
End If
End If
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top