首页 > 代码库 > SecureCRT自动备份脚本-华为
SecureCRT自动备份脚本-华为
# $language = "VBScript"# $interface = "1.0"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\list2.txt",Forreading, False) crt.Screen.Synchronous = True do while file1.AtEndOfStream <> True ‘读取每一行 line = file1.ReadLine ‘分割IP,用户名,密码 params = Split (line) crt.session.LogFileName = "D:\SWbackup\log\" & params(0) & ".txt" crt.session.Log(true) ‘telnet登录 crt.Session.Connect "/TELNET " & params(0) ‘输入用户名 crt.screen.WaitForString "Username:",1 crt.screen.send params(1) & Chr(13) ‘输入密码 crt.Screen.WaitForString "Password:" crt.Screen.Send params(2) & Chr(13) ‘进入特权模式(enable) crt.Screen.Send "system-view" & Chr(13) crt.Screen.waitForString "]" ‘执行dis cur命令 crt.Screen.Send "dis cur" & Chr(13) crt.Screen.Send " " crt.screen.send Chr(13) crt.Screen.waitForString "return" crt.Screen.waitForString "]" crt.screen.send Chr(13) ‘执行dis ip int b命令 crt.Screen.Send "dis ip int b" & Chr(13) crt.Screen.Send " " crt.screen.send Chr(13) crt.Screen.waitForString "]" ‘执行dis int b命令 crt.Screen.Send "dis int b" & Chr(13) crt.Screen.Send " " crt.screen.send Chr(13) crt.Screen.waitForString "]" crt.screen.send Chr(13) ‘断开连接 crt.Session.Disconnect loop crt.Screen.Synchronous = False End Sub
SecureCRT自动备份脚本-华为
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。