How to reset the passwords of all users in a specific OU

Reason

We have imported a number of users in the active directory then we need to set passwords for all of those users. To reset the password of all users following steps.

Solution

1. The easiest way is to use DSQUERY

Get the list of users in a specific OU and pipe the result to DSMOD for changing the password.

      • DSQUERY – finds users in the Active Directory with the specified search criteria
      • DSMOD – is used to modify the attribute of one or more existing users in the Active Directory.
      • Limit 0 – all objects meeting the query criteria will be returned. When no limit switch is used, the first 100 results will be displayed.

DSQUERY user “path of ou ” -limit 0 | DSMOD user -pwd “password”

Example

DSQUERY user “OU=Network,DC=ad,DC=learneraxe,DC=local” -limit 0 | DSMOD user -pwd “P@ssw0rd_12#” -mustchpwd “yes”

To reset passwords, open the command prompt or powershell with elevated mode and type the command.

 

Leave a Comment

Your email address will not be published. Required fields are marked *