Windows – Reset all User Passwords in an OU

KB ID 0000497 

Problem

I did some bulk user imports for a client this week, and then needed to set all the passwords on these accounts. Seeing as it was a school, and each year group was in its own OU in Active Directory, I needed a way to “Bulk Reset” the passwords.

Note: Passwords can NOT be set with a CSV / CSVDE import.

Solution

1. We are going to perform this procedure while logged onto a domain controller with appropriate administrative rights.

2. Start > In the Search/run box type cmd {enter}

3. At command line issue the following command:

[box]dsquery user {LDAP path to the OU} | dsmod user -pwd the-new-password[/box]

Examples,

dsquery user OU=Intake2011,OU=Students,DC=petenetlive,DC=com | dsmod user -pwd P@ssword123

dsquery user “OU=Intake 2011,DC=petenetlive,DC=com” | dsmod user -pwd P@ssword123

Note: In the second example there is a space in the path (In the OU name Intake 2011) that’s why the path has been surrounded by quotes/speech marks. If you forget you will see an error like the one below:

Note 2: The display will only show 100 results by default (that does NOT mean anything has failed!) you will see the following though:

To see more results simply add “-limit {number}” after the LDAP path and before the pipe symbol e.g.

[box]dsquery user {LDAP path to the OU} -limit 300 | dsmod user -pwd the-new-password[/box]

Examples,

dsquery user OU=Intake2011,OU=Students,DC=petenetlive,DC=com -limit 300 | dsmod user -pwd P@ssword123

dsquery user “OU=Intake 2011,DC=petenetlive,DC=com” -limit 1500 | dsmod user -pwd P@ssword123

Related Articles, References, Credits, or External Links

NA