Automate change of multiple local user passwords on a single server

We recently setup approx. 70 local user accounts on a server for our vendors to access. All the users are part of a local group. As part of our company policy the passwords need to be changed every 60 days. We would like to create a script or batch file to change the passwords on each of these accounts. The passwords should be pulled from a pre-generated file, created by Quicky Password Generator, as each vendor will have a different password. I have attached an example of the generated file. Any help or direction is appreciated.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can do this from the command prompt. To change the password of a user from the command prompt, go to Run > cmd.  Command prompt will open. Use the following commands to change the password:
net user username password /domain

You can write a batch file that takes as input the contents of the generator file.
The code to change a password is pretty easy:
Set objUser = GetObject("WinNT://server01/Pre2KNamer")

Probably the easiest way to change their passwords would be to use a "net localgroup vendorgroupname >vendornames.txt" to export the list of hte vendors you have to a txt file. Next, clean up the text file because net localgroup creates some extra info.  Lastly, use another piece of vbscript to read the vendor file and the password file and change passwords.

Paste the script below into a text file with a .vbs extension.  Customize the value of the strComputer variable on line 7 with the target computer name.  Customize the value of the strGroup variable on line 8 with the name of the local group.  Customize the value of the strPwList variable with the location of the password list.

Running the script will reset the passwords of all users in the group and output the usernames with their new passwords to a comma-delimited text file.

Const ForReading = 1
Const ForWriting = 2
Const TriStateUseDefault = -2
On Error Resume Next
strComputer = "server01"
strGroup = "vendors"
strPwList = "c:\files\qpwords.txt"
strReport = "report.csv"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objPwList = objFSO.OpenTextFile(strPwList, ForReading, False, TriStateUseDefault)
Set objReport = objFSO.OpenTextFile(strReport, ForWriting, True)
Set objGroup = GetObject("WinNT://" & strComputer & "/" & strGroup)
For Each objUser in objGroup.Members
    strPw = objPwList.ReadLine
    objReport.WriteLine objUser.Name & "," & strPw

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.