PowerShell Reset Password for all Users in an Active Directory OU

PowerShell Reset Password for all Users in an Active Directory OU. To reset the password for all the users in an OU , you can follow one of these ways.

1. The easiest way is to use DSQUERY (Not worked for me)

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

The command is :

DSQUERY user "OU=name_ou,DC=domain,DC=com" -limit 0 | DSMOD user -pwd "new_pass"

NOTE: You just need to change the name of OU and DC with the Distinguished Name of the OU in your ActiveDirectory that contains the users.

2. Using Get-ADUser (Work perfectly for me)

To get all the users in a specific OU and send them to Set-ADAccountPassword for password change.

Here is the command:

Get-ADUser -Filter * -SearchScope Subtree -SearchBase "OU=ou_name,DC=domain,DC=loc" | Set-ADAccountPassword -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "new_pass" -Force)

NOTE: You just need to change the name of OU and DC with the Distinguished Name of the OU in your ActiveDirectory that contains the users.

You might also like

Leave a Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More