?
Solved

Force password change for domain users

Posted on 2008-11-05
8
Medium Priority
?
1,631 Views
Last Modified: 2008-11-14
We have a Windows 2003 Domain Controller with Active Directory.  I will change the domain policy to require password complexity, change password every 60 days, etc.  I know there are accounts in Active Directory where the "password never expires" option is checked.  How can I easily find all of them that have this option checked without going through each account individually?  Also, when I change the default domain policy for passwords, will this override the individual accounts option (i.e. if the domain policy says it has to be change every 60 days, will this override the "password never expires" option)?
0
Comment
Question by:maharlika
8 Comments
 
LVL 17

Expert Comment

by:JohnGerhardt
ID: 22887676
Have a look @ this..
http://www.microsoft.com/technet/scriptcenter/resources/qanda/aug05/hey0829.mspx
If you want thelp with script post back...
0
 
LVL 35

Accepted Solution

by:
Joseph Daly earned 1000 total points
ID: 22887780
Here you go. What the below script does is query every user account in AD and then will return their last name, first name, and wether their password never expires mark is checked.
dsquery user -samid * -limit 0| dsget user -ln -fn -pwdneverexpires

Open in new window

0
 
LVL 9

Expert Comment

by:samiam41
ID: 22887883
@xxdcmast:  Wow!  Nice script.  I have been trying to figure a way to do this for my environment.  Not to steal anyone's thunder but thanks for the script!
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
LVL 17

Expert Comment

by:JohnGerhardt
ID: 22887903
I second that, very simpe..
0
 
LVL 35

Expert Comment

by:Joseph Daly
ID: 22887913
the following query should do the same as the above query but using an LDAP filter.

dsquery * -filter "(&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=65536))" -limit 0 |dsget user -ln -fn -pwdneverexpires

Open in new window

0
 
LVL 35

Expert Comment

by:Joseph Daly
ID: 22887955
Now you may want to do some testing on this but the script below should CHANGE them all to uncheck the password never expires.

Be careful with the script below.
dsquery * -filter "(&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=65536))" -limit 0 |dsmod user  -pwdneverexpires no

Open in new window

0
 
LVL 3

Author Comment

by:maharlika
ID: 22891007
xxdcmast, thanks for the great script.
Also: if password never expires = yes, does that override the default domain policy that says it has to be changed every 60 days?
0
 
LVL 35

Expert Comment

by:Joseph Daly
ID: 22891579
Thats a good question I would assume that the settings in AD would override the default domain policy but honestly I cant say for sure.

You could always test it out by setting a gpo on a TEST OU with password change of 1 day and see what happens.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
Saved searches can save you time by quickly referencing commonly searched terms on any topic. Whether you are looking for questions you can answer or hoping to learn about a specific issue, a saved search can help you get the most out of your time o…

850 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