Thursday, June 15, 2006

Reset User Passwords using DSQuery

Reset a complicated collection of users passwords the easy way using DSQuery. First use the Saved Queries function within Active Directory Users and Computers to narrow down the query and ensure you have the users required; for example all of the Bristol Office Staff.

The edit Copy the Query String from the Saved Query you have created and use it the following way from the command line:

dsquery * -filter "(&(objectCategory=user)(physicalDeliveryOfficeName=Bristol*))"

This will then return all of the users as in the saved query

The add the following to the end of the line which will then dsmod all of the users to reset the passwords.

dsmod user -pwd "P@ssword"

Dave