Change User Passwords in AD from an Excel List

I need the ability to reset multiple user's passwords using unique predefined passwords. I would like to be able to have one column for the user's user name and the other the password needed to be changed too.

It needs to look like:

Username:        Password:
ABC                   123
DEF                    456

If i could get PowerShell or VB to read from this that would be awesome.

Thanks for you help. It is greatly appreciated.            
Who is Participating?
Todd GerbertIT ConsultantCommented:
Put usersnames and password in a text file, separated by a comma, use command line:

for /F "tokens=1,2 delims=," %i in (yourfile.txt) do net user %i %j /domain
bjohnson_MNAuthor Commented:
I get an error saying C:\test.txt was unexpected at this time. Any thoughts??
Todd GerbertIT ConsultantCommented:
This is executed at a command prompt, it's not VBScript.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

bjohnson_MNAuthor Commented:
Yeah I tried it at the command prompt. It will not read my text file and kicks back the "C:\test.txt was unexpected at this time"  The output is below.

C:\Users\showard>for /F "tokens=1,2 delims=," %i in "C:\test.txt" do net user %i
 %j /domain
"C:\test.txt" was unexpected at this time.

Todd GerbertIT ConsultantCommented:
You need the parentheses.

for /F "tokens=1,2 delims=," %i in (C:\test.txt) do net user %i %j /domain
what OS are you running?
I created a test file (by another name) and tried the command as is and it works.
As long as you have permissions to execute the command ... you would have to ahve the appropriate admin rights to do a password change.

Hmmm ... are you working on a machine that is in an AD domain?  If not, and you are working with local accounts, try leaving off the /domain reference at the end of the command.  Another difference in what I tried.
bjohnson_MNAuthor Commented:
It works. I thought you didn't need the parentheses but I guess you do. Thank you so much for the quick response. It is greatly appreciated.

bjohnson_MNAuthor Commented:
Thank you so much. In 10 minutes you solved my 2 hours of frustration with VB. You are a God send.
Hi There... this is exactly what I have been looking for but I get the error message befoer the file name:

C:\>for /F "tokens=, delims=,"%i in "1.txt" do net user %i %j /domain
in was unexpected at this time.

I am running this command logged on as a domain administrator and have verified access to ADUC whilst logged onto a domain controller.

Any ideas?

Todd GerbertIT ConsultantCommented:
You need to put your filename in parentheses, not quotes.  Check "for /?" for all the nitty gritty details on syntax, and you should consider asking your own question if you run into any issues beyond this.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.