Question : 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.

Answer : Automate change of multiple local user passwords on a single server

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.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
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
    objUser.SetPassword(strPw)
    objReport.WriteLine objUser.Name & "," & strPw
Next
 
objPwList.Close
objReport.Close
Open in New Window Select All
Random Solutions  
 
programming4us programming4us