PowerShell Reset Пароль for all Users in an Active Directory OU. To reset the пароль for all the users in an OU, you can follow one of these ways.
1. The easiest way is to use DSQUERY (Not work for me)
Get the list of users in a specific OU and pipe the result to DSMOD for changing the пароль.
The command is:
DSQUERY user "OU=name_ou,DC=domain,DC=com" -limit 0 | DSMOD user -pwd "new_pass"
ПРИМІТКА: 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 для пароль 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)
ПРИМІТКА: 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.
Good article Shared to Reset all user passwords in OU. This article really helps a lot
How we can Enable or Disable AD User using Powershell.
Thanks for sharing this article