Solved

How to automatically uncheck Password Never Expires for all user in an OU?

Posted on 2004-08-24
4
545 Views
Last Modified: 2008-03-10
Hello Experts!  I'm looking for a way to AUTOMATICALY uncheck the "Password Never Expires" option on user account properties for all users under an OU.  What would be the easiest way to do this?
0
Comment
Question by:mb2010
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
Debsyl99 earned 250 total points
ID: 11888338
Hi
You could use a vb script - Try paste the following into a text file, add your relevant ou and dc and rename the file to yourfile.vbs ensuring a .vbs extension and a name you'll recognise, then test the script on a test ou prior to applying it,

Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
Set OU = GetObject("LDAP://OU=yourou, DC=yourdomain,DC=com")
'Gather each username.
For Each oUser In OU
'Make sure they are only USER class.
If oUser.Class = "user" Then
intUAC = oUser.Get("userAccountControl")
If ADS_UF_DONT_EXPIRE_PASSWD AND intUAC Then
oUser.Put "userAccountControl", intUAC XOR _
ADS_UF_DONT_EXPIRE_PASSWD
oUser.SetInfo
End If
End If
Next
Wscript.echo "All password expiry settings for the ou are unchecked"
Wscript.Quit

Deb :))
0
 

Author Comment

by:mb2010
ID: 11895358
Works perfect!  I LOVE IT!

Thanks much!!
0
 
LVL 20

Expert Comment

by:Debsyl99
ID: 11895384
Thanks - glad to help!

Deb :))
0
 

Author Comment

by:mb2010
ID: 11895668
Forgot to ask.  Will this script work on the sub OUs also?  If not, I need it to do so.  Thanks much!
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FIPS stands for the Federal Information Processing Standardisation and FIPS 140-2 is a collection of standards that are generically associated with hardware and software cryptography. In most cases, people can refer to this as the method of encrypti…
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question