?
Solved

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

Posted on 2004-08-24
4
Medium Priority
?
546 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 1000 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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

A brief overview to explain gateways, default gateways and static routes OR NO - you CANNOT have two default gateways on the same server, PC or other Windows-based network device. In simple terms a gateway is formed when a computer such as a serv…
Trying to figure out group policy inheritance and which settings apply where can be a chore.  Here's a very simple summary I've written which might help.  Keep in mind, this is just a high-level conceptual overview where I try to avoid getting bogge…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

743 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