Hello,
Here is a vbscript from the famous Brian Desmond.
Fill a workstations.txt with workstations names and the newPass = ""
If you don't know how to fill the text file, please let me know.
If you administrator local name is not "Administrator", change it in the
script (line WinNT://" & line & "/Administrator, user")
'==========================================================================
' NAME: Change local administrator password on list of machines
' AUTHOR: Brian Desmond
' DATE : 6/19/2006
'==========================================================================
Option Explicit
' What to change the password to
Const newPass = ""
Const LogFile = "AdminReset.log"
Const inputFile = "workstations.txt"
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Dim shl
Set shl = WScript.CreateObject("WScript.Shell")
Dim fil
Set fil = fso.OpenTextFile(inputFile)
WriteToLog "Beginning Pass of " & inputFile & " at " & Now()
WScript.Echo "Beginning Pass of " & inputFile & " at " & Now()
'On Error Resume Next
Dim usr
Dim line
Dim exec
Dim pingResults
While Not fil.AtEndOfStream
line = fil.ReadLine
Set exec = shl.Exec("ping -n 2 -w 1000 " & line)
pingResults = LCase(exec.StdOut.ReadAll)
If InStr(pingResults, "reply from") Then
WriteToLog line & " responded to ping"
WScript.Echo line & " responded to ping"
On Error Resume Next
Set usr = GetObject("WinNT://" & line & "/Administrator, user")
usr.SetPassword newPass
usr.SetInfo
If Err.Number <> 0 Then
WriteToLog "Error resetting password on " & line & ": " &
Err.Description
WScript.Echo "Error resetting password on " & line & ": " &
Err.Description
Err.Clear
Else
WriteToLog "Password Reset on " & line
WScript.Echo "Password Reset on " & line
End If
Else
WriteToLog line & " did not respond to ping"
WScript.Echo line & " did not respond to ping"
End If
Wend
fil.Close
Sub WriteToLog(LogData)
On Error Resume Next
Dim fil
'8 = ForAppending
Set fil = fso.OpenTextFile(LogFile, 8, True)
fil.WriteLine(LogData)
fil.Close
Set fil = Nothing
End Sub
Set usr = Nothing
Set fil = Nothing
Set fso = Nothing
Set shl = Nothing
--
Cordialement,
Mathieu CHATEAU
English blog:
http://lordoftheping.blogspot.com
French blog:
http://www.lotp.fr