LDAP query that finds all locked out accounts:
(&(objectCategory=Person)(
VBScript
Main Topics
Browse All TopicsIs there a way to have a job automatically search and unlock "locked out" AD accounts?
I know this is a security risk, however I would like a way to also display which accounts have been unlocked to see if there is a pattern.
I'm currently using a software package called "Bulk Password Control" and run "Unlock" on all of our company users. However, I must do this job manually everytime.
Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Or if you have admin pack installed, use dsquery to find the locked accounts and use dsmod to unlock them
checking current groups of a named user
- dsget user "CN=Ryan Coates,CN=Users,DC=godlike
adding a user to a new group
- dsmod group "CN=Domain Admins,CN=Users,DC=godlike
searching for a group (like you can in the GUI AD)
- dsquery group -name Domain*
password resets
- dsmod user "CN=Ryan Coates,CN=Users,DC=godlike
searching for a user
- dsquery user -name Ryan*
unlocking an account
- dsmod user "CN=Ryan Coates,CN=Users,DC=godlike
A better way to do all that is pipe it all through the dsquery command so you dont have to use the full DN for most of those
like say changing a passowrd
- dsquery user -name Ryan*
if that returns only one result press UP to get your history back and add to it
- dsquery user -name Ryan* | dsmod user -pwd l0s3r -mustchpwd yes
Check out these links for more detailed use of these tools
DSMod (http://www.microsoft.com/
DSQuery (http://www.microsoft.com/
DSGet (http://www.microsoft.com/
However, the easiest way to do this would be to use joeware :)
The quickest is to use the unlock tool. http://www.joeware.net/fre
The command to see all locked accounts is unlock . * -view
To unlock all locked accounts it would be unlock . *
Business Accounts
Answer for Membership
by: chukuPosted on 2009-08-24 at 10:16:04ID: 25170330
lockoutstatus.exe using the right commands in a script can do the job m/download s/details. aspx? Famil yID=D1A5ED 1D-CD55-48 29-A189-99 515B0E90F7 &displayla ng=en
http://www.microsoft.co
as you said, it is very riski