Hello,
This is my first attempt at building a script, I've been working on a script to change local administrator passwords on all PC's within an OU. I have one major concern that I haven't been able to figure out, I need to output the results of the script to a file and need to know if there's a way to output whether or not the password change was a success. We have a 100+ pc's and I can't afford to second guess or have to go around machine to machine.
Any help would be great, I have listed what I've built below, please keep in mind my knowlege is limited and I've used the web to help ...
On Error Resume Next
Set objOU = GetObject("LDAP://OU=Vista
Computers,dc=corp,dc=ca"
objOU.Filter = Array("Computer")
For Each objComputer in objOU
strComputer = objComputer.CN
Set objShell = CreateObject("WScript.Shel
l")
strCommand = "%comspec% /c ping -n 3 -w 1000 " & strComputer & ""
Set objExecObject = objShell.Exec(strCommand)
Do While Not objExecObject.StdOut.AtEnd
OfStream
strText = objExecObject.StdOut.ReadA
ll()
If Instr(strText, "Reply") > 0 Then
'Change password
' ==========================
==========
==========
==========
==========
===
strComputer = objItem.CN
Set objUser = GetObject("WinNT://" & strComputer & "/Administrator")
objUser.SetPassword("99new
password55
")
' ==========================
==========
==========
==========
==========
===
Set objComputer = GetObject("WinNT://" & strComputer & "")
objComputer.Filter = Array("User")
For Each objUser in objComputer
Wscript.Echo objUser.Name
Next
' ==========================
==========
==========
==========
==========
===
' End
' ==========================
==========
==========
==========
==========
===
Else
Wscript.Echo strComputer & " could not be reached."
End If
Loop
Next
Start Free Trial