交换机SSH方式的批量备份的实现本程序适合用于中兴、思科等命令体系的设备,验证方式为SSH加密首先对交换机的信息保存为以下txt格式文件,每行分别依次为交换机的登录ip、用户名、密码、特权密码,中间用空格隔开。如allswip.txt:10.100.100.X用户名A密码A二级密码A10.100.101.X用户名B密码B二级密码B10.100.102.X用户名C密码C二级密码C……………………………………………………利用secureCRT(最好6.0版本以上)程序软件,点击菜单栏里的脚本,运行交换机名称登录程序.vbs文件(代码如下),#$language=VBScript#$interface=1.0crt.Screen.Synchronous=TrueSubMainConstForReading=1,ForWriting=2Dimfso,file,str,paramsSetfso=CreateObject(Scripting.FileSystemObject)Setfile=fso.OpenTextFile(文件路径/allswith.txt,Forreading,False)crt.Screen.Synchronous=TrueDOWhilefile.AtEndOfStreamTruestr=file.ReadLineparams=Split(str)cmd=/SSH2/L&用户名&/PASSWORD&密码&/C3DES/MMD5¶ms(1)crt.Session.Connectcmdcrt.screen.SendChr(13)crt.Screen.WaitForStringcrt.Screen.Senden&chr(13)crt.Screen.WaitForStringPassword:crt.Screen.Send特权密码&chr(13)crt.Screen.WaitForString#crt.Screen.Sendcopyflash:/cfg/startrun.dat地址¶ms(2)&.dat@FTP用户名:FTP密码&chr(13)crt.Screen.WaitForString#crt.Screen.Sendexit&chr(13)crt.Session.disConnectLoopcrt.Screen.Synchronous=FalseEndSub