用crt的脚本工具,选择执行脚本直接执行 telnet修改密码((不过里面的代码以及路径自己修改):
# $language = "Vbscript"
# $interface = "1.0"
"本脚本示范:从一个文件里面自动读取设备IP地址,密码等,自动将设备配置备份
Sub Main
"打开保存设备管理地址以及密码的文件
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso,file1,line,str1,params
Set fso = CreateObject("Scripting.FileSystemObject")
Set file1 = fso.OpenTextFile("d:\SWbackup\list.txt",Forreading, False)
crt.Screen.SynchrOnous= True
DO While file1.AtEndOfStream <> True
"读出每行
line = file1.ReadLine
"分离每行的参数 IP地址 密码 En密码
params = Split (line)
crt.session.LogFileName = "d:\SWbackup\log\20120331\" & params(0) & ".txt"
crt.session.Log(true)
"Telnet到这个设备上
crt.Session.Connect "/TELNET " & params(0)
"输入telnet密码
crt.Screen.WaitForString "Password:"
crt.Screen.Send params(1) & vbcr
"进特权模式
crt.Screen.Send "enable" & vbcr
crt.Screen.WaitForString "Password:"
crt.Screen.Send params(2) & vbcr
crt.Screen.waitForString "#"
"备份目前runing-config配置
str1 = "show run"
crt.Screen.Send str1 & vbcr
crt.Screen.WaitForString " --More-- "
crt.Screen.Send "
控制器是运维管理平台吗