0

I have a list of user accounts that need their password reset to a default password (also users will be required to change the password at first login). Is there a way to reset the password for a list of Active Directory users en-mass? I'd rather not use any third party software. Can I do this in dsa.exe? Or can this be done with a power-shell script? I've seen some examples that reset the passwords for all users in an OU but this will not work for me. I need to reset the passwords for only 50 of 300 users in the same OU.

user134977
  • 1
  • 1
  • 1

3 Answers3

3

If all accounts are to be reset to the same password, you could probably do something like this:

for /f %%u in (users.txt) do @net user %%u PASS /logonpasswordchg:yes /domain
Ansgar Wiechers
  • 4,247
  • 2
  • 18
  • 26
3

Yup.

You can loop and read in the names of the accounts you need to reset from a .csv of the usernames, which you hopefully already have in a list somewhere.

If you have the AD module for PowerShell, it's even easier (you can also read in a .csv of the usernames with this method, instead of using a filter).

First, you need to import ActiveDirectory Module

Import-Module ActiveDirectory

Second, generate a SecureString which contains the password.

$securePwd = ConvertTo-SecureString -String "P@ssw0rd!" -Force -AsPlainText

Third, find the Active Directory users ,and use Set-ADAccountPassword for resetng the password.

Get-ADUser -Filter {Name -like "Test"} | Set-ADAccountPassword -NewPassword $securePwd*

Also, you can review following link for more details about the Active Directory cmdlets.

Active Directory Cmdlets in Windows PowerShell

http://technet.microsoft.com/en-us/library/ee617195.aspx

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
3

This question is already been discussed at the community before. Please refer to this link

How do I bulk reset passwords for all users in an OU?

and you can go for this link also Mass password change at active directory

http://blog.scottlowe.org/2005/12/08/mass-password-changes-in-active-directory/

ELse go for a freeware tool such as Lepide Active Directory Self service. It will allow you to change the password for limitation up to 50 users.

jeorge book
  • 101
  • 4
  • The question specifically states that the users are not all in the same OU. How does the other question you linked relate to this one, then? – Adrian Heine Nov 22 '12 at 12:41