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 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| strPassword = "password"
Const InputFile = "Liste Servers.txt"
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(InputFile, ForReading)
strComputers = objFile.ReadAll
objFile.Close
arrComputers = Split(strComputers, vbCrLf)
On Error Resume Next
For Each strComputer In arrComputers
' Pinging. Inten
Set objShell = CreateObject("Wscript.Shell")
Set objScriptExec = objShell.Exec("ping -n 2 -w 1000 " & strComputer)
If InStr(objScriptExec.StdOut.ReadAll, "Reply") > 0 Then
' User manipulation, in my case the user is "Test",
' change it to the local Administrator user name
Err.Clear
Set objUser = GetObject("WinNT://" & strComputer & "/test, user")
If Err.Number Then
WScript.Echo " " & strComputer & " - ERROR: User name not found"
Err.Clear
Else
objUser.SetPassword strPassword
objUser.SetInfo
WScript.Echo " " & strComputer & " - Password successfully changed"
End If
Else
WScript.Echo " " & strComputer & " - ERROR: Host not responding"
End If
Next |
Partager