‘——–Start Of Script——–
Option Explicit
On Error Resume Next
Dim WshShell, strIP, strTFTP, strFile, strPassHP, strUser
Dim filesys, filetxt
strFile = « list_switch.txt »
strTFTP = « TFTP Server »
strUser = « manager »
strPassHP = « Password »
‘Opens IP address file for reading
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set filesys = CreateObject(« Scripting.FileSystemObject »)
Set filetxt = filesys.OpenTextFile(strFile, ForReading, True)
‘Opens the command prompt
set WshShell = CreateObject(« WScript.Shell »)
WshShell.run « cmd.exe »
WScript.Sleep 1000
Do While Not filetxt.AtEndOfStream
strIP = filetxt.ReadLine
Copy(strIP)
Loop
filetxt.Close
set WshShell = Nothing
set filesys = Nothing
WScript.Quit
Function Copy(strIP)
WshShell.SendKeys « telnet « & strIP
WshShell.SendKeys (« {Enter} »)
WScript.Sleep 1000
WshShell.SendKeys strUser
WshShell.SendKeys (« {Enter} »)
‘WshShell.SendKeys « p »
WshShell.SendKeys strPassHP
WshShell.SendKeys (« {Enter} »)
WshShell.SendKeys « copy running-config tftp » & strTFTP & » » & strIP & « .txt »
WshShell.SendKeys (« {Enter} »)
WshShell.SendKeys « ^z »
WshShell.SendKeys « ^z »
WshShell.SendKeys « y »
WScript.Sleep 2000
WshShell.SendKeys (« {Enter} »)
End Function
‘——–End Of Script——–
Source : Spencer’s IT Tips & Tidbits: Automate HP Switch Config Backup