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
Solved

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

Posted on 2004-08-24
4
542 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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
This article is in response to a question (http://www.experts-exchange.com/Networking/Network_Management/Network_Analysis/Q_28230497.html) here at Experts Exchange. The Original Poster (OP) requires a utility that will accept a list of IP addresses …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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