'this code will read IPs from host.txt file and change the passwords
Option Explicit
Dim objFile, strLine
Dim sInput,nInput,rInput,WshShell
Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
sInput = InputBox("Enter your old password")
nInput = InputBox("Enter your new password")
rInput =InputBox("Enter your reenter new password")
set WshShell = WScript.CreateObject("WScript.Shell")
Set objFile= objFSO.OpenTextFile("hostname.txt", 1)
Do While Not objFile.AtEndOfStream
strLine = objFile.readline
WshShell.Run "putty.exe "&strLine&":22 -l demo -pw "&sINPUT
WScript.Sleep 2000
WshShell.AppActivate strLine&":22 - PuTTY"
WshShell.SendKeys "passwd {ENTER}"
WScript.Sleep 1000
WshShell.SendKeys sINPUT&"{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys nINPUT&"{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys rINPUT&"{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 1000
Loop
objFile.Close
Option Explicit
Dim objFile, strLine
Dim sInput,nInput,rInput,WshShell
Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
sInput = InputBox("Enter your old password")
nInput = InputBox("Enter your new password")
rInput =InputBox("Enter your reenter new password")
set WshShell = WScript.CreateObject("WScript.Shell")
Set objFile= objFSO.OpenTextFile("hostname.txt", 1)
Do While Not objFile.AtEndOfStream
strLine = objFile.readline
WshShell.Run "putty.exe "&strLine&":22 -l demo -pw "&sINPUT
WScript.Sleep 2000
WshShell.AppActivate strLine&":22 - PuTTY"
WshShell.SendKeys "passwd {ENTER}"
WScript.Sleep 1000
WshShell.SendKeys sINPUT&"{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys nINPUT&"{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys rINPUT&"{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 1000
Loop
objFile.Close
Comments
Post a Comment