(1) Create a new text file (note the save path, this test path is D:\backup\list.txt):
x.x.x.x username Password Enable_password (#注: If no enable password can not be written; Each item is separated by a space)
(2) Create a new text file H3C.txt (path D:\backup\H3C.txt) with the following contents:
# $language = "VBScript"
# $interface = "1.0"
' Script Demo: Automatically read device IP address, password, etc. from a file, automatically backup the device configuration
Sub Main
' Open the file where the device management address and password are saved
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim Fso,file1,line,str1,params
Set fso = CreateObject ("Scripting.FileSystemObject")
Set file1 = fso. OpenTextFile ("D:\backup\list.txt", Forreading, False)
Crt. Screen.synchronous = True
Do and File1. AtEndOfStream <> True
' read out each line
line = File1. ReadLine
' Separate parameters for each line IP address password en password
params = Split (line)
Crt.session.LogFileName = "D:\backup\h3c\201611\" & Params (0) & ". txt"
Crt.session.Log (True)
' Telnet to this device
Crt. Session.connect "/telnet" & params (0)
Crt. Screen.waitforstring "Username:"
Crt. Screen.send params (1) & CHR (13)
' Enter the Telnet password
Crt. Screen.waitforstring "Password:"
Crt. Screen.send params (2) & CHR (13)
' Enter privileged mode
Crt. Screen.send "Sup" & CHR (13)
Crt. Screen.waitforstring "Password:"
Crt. Screen.send params (3) & CHR (13)
Crt. Screen.waitforstring ">"
' Backup current Runing-config configuration
str1 = "Disp cur"
Crt. Screen.send str1 & CHR (13)
Crt. Screen.waitforstring "----more----"
Crt. Screen.send ""
' Crt. Screen.send CHR (13) "& vbcr
' Exit when Backup is complete
Crt. Screen.waitforstring "Return"
Crt. Screen.waitforstring ">"
' Execute disp int br command
Crt. Screen.send "disp int Brief" & Chr (13)
Crt. Screen.waitforstring "----more----"
Crt. Screen.send ""
Crt. Screen.waitforstring ">"
Crt.screen.send CHR (13)
Crt. Session.disconnect
Loop
Crt. Screen.synchronous = False
End Sub
(3) Modification of the above text suffix is for. vbs, i.e. H3c.vbs;
(4) To run the CRT software, menu bar--------to find the script path D:\backup\H3C.vbs;
(5) View backup file save path
This article from the "Moon Empty" blog, please be sure to keep this source http://13001500368.blog.51cto.com/2905946/1872902
Automatic backup of network devices using SECURECRT-Huawei, H3C