利用SecureCRT脚本对思科设备进行批量备份:

(1)新建文本文件(注意保存路径,本次测试路径为D:\backup\list.txt):

  x.x.x.x username password enable_password   (#注:如果没有enable密码可以不写;每项用空格分割)

(2)新建文本文件cisco.txt(路径D:\backup\cisco.txt),内容如下:

# $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\list.txt",Forreading, False)
crt.Screen.Synchronous = True
do while file1.AtEndOfStream <> True
line = file1.ReadLine
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 "enable" & Chr(13)
crt.Screen.waitForString "#" '执行sh run命令
crt.Screen.Send "sh run" & Chr(13)
crt.Screen.WaitForString " --More-- "
crt.Screen.Send " "
crt.screen.send Chr(13)
crt.Screen.waitForString "end"
crt.Screen.waitForString "#"
'执行sh ip int b命令
crt.Screen.Send "sh ip int b" & Chr(13)
crt.Screen.Send " "
crt.Screen.waitForString "#"
crt.screen.send Chr(13)
'保存配置
crt.Screen.Send "wr" & Chr(13)
crt.Screen.waitForString "[OK]",8
crt.Screen.waitForString "#"
crt.screen.send Chr(13)
'断开连接
crt.Session.Disconnect loop
crt.Screen.Synchronous = False
End Sub

(3)修改上面文本后缀个是为.vbs,即cisco.vbs;

(4)运行CRT软件,菜单栏-->脚本-->执行-->找到脚本路径D:\backup\cisco.vbs;

(5)查看备份文件保存路径D:\backup\conf\。

 

SecureCRT自动备份脚本-思科的更多相关文章

  1. SecureCRT自动备份脚本-华为

    # $language = "VBScript" # $interface = "1.0" Sub Main Const ForReading = 1, For ...

  2. Windows环境下Oracle数据库的自动备份脚本

    批处理文件(.bat) @echo off echo ================================================ echo  Windows环境下Oracle数据 ...

  3. Oracle自动备份脚本(网上找到的资料)

    废话不多说了,直接给大家贴代码了,具体代码如下所示: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ...

  4. Mysql 自动备份脚本

    转自: Mysql 自动备份脚本2 - - ITeye技术网站http://kangh.iteye.com/blog/2309091 备份方案: 备份主机:192.168.10.11 数据库服务器:1 ...

  5. oracle expdp自动备份脚本

    windows: @echo off echo ================================================ echo Windows环境下Oracle数据库的自动 ...

  6. Oracle自动备份脚本的实现

    问题描述: Oracle自动备份脚本的实现. 错误提示1: Message file RMAN.msb not found Verify that Oracle_HOME is set properl ...

  7. MySQL binlog 自动备份脚本

    MySQL binlog 自动备份脚本 1 利用shell进行备份 #!/bin/sh #mysql binlog backup script /usr/local/mysql/bin/mysqlad ...

  8. Oracle数据库的自动备份脚本

    @echo off echo ================================================ echo Windows环境下Oracle数据库的自动备份脚本 echo ...

  9. Windows环境下Oracle数据库的自动备份脚本自动删除30天前的备份

    @echo off echo ================================================ echo Windows环境下Oracle数据库的自动备份脚本 echo ...

随机推荐

  1. 【spring data jpa】使用repository进行查询,使用userRepository.getOne(id)和userRepository.findById(id)无法从数据库查询到数据

    如题: 使用repository进行查询,使用CrudRepository自带的getOne()方法和findById()方法查询,数据库中有这条数据,但是并不能查到. userRepository. ...

  2. Weblogic内存溢出及常用参数配置

        http://www.360doc.com/content/14/0306/14/16134804_358216319.shtml 一.WebLogic内存溢出 最近访问量门户访问量突然增大, ...

  3. 分布式版本号控制系统Git(二):github

    前言 但凡是喜欢研究技术,或者听大牛们说起过的,都应该至少是听过github这个东西.详细就不介绍了.不了解的能够去了解了解,最基本的功能当然是代码托管啦,上面有各种各样的大牛写的项目. 另外这一章不 ...

  4. 【转】supervisord使用

    Supervisor (http://supervisord.org) 是一个用 Python 写的进程管理工具,可以很方便的用来启动.重启.关闭进程(不仅仅是 Python 进程).除了对单个进程的 ...

  5. [Servlet&amp;JSP] 从JSP到Servlet

    JSP与Servlet是一体的两面,JSP最后都会被容器转译为Servlet源码,自己主动编译为.class文件,载入.class文件然后生成Servlet对象. 由容器转译后的Servlet类具有_ ...

  6. Git以及github的使用方法(六),管理修改

    现在,假定你已经完全掌握了暂存区的概念.下面,我们要讨论的就是,为什么Git比其他版本控制系统设计得优秀,因为Git跟踪并管理的是修改,而非文件. 你会问,什么是修改?比如你新增了一行,这就是一个修改 ...

  7. 无法安装 golang.org/x/tools/的库

    安装godep 官方的安装文档是使用go get github.com/tools/godep,很可惜,因为“网络”问题会报一个找不到golang.org/x/tools/go/vcs的错误. 而ht ...

  8. sql语言复习2

    一.查询 select 字段列表 from 表名列表 [where 条件表达式][group by 字段列表[having 条件表达式]] [order by 字段列表[asc|desc]] 含义:在 ...

  9. js replace 全局替换 以表单的方式提交参数 判断是否为ie浏览器 将jquery.qqFace.js表情转换成微信的字符码 手机端省市区联动 新字体引用本地运行可以获得,放到服务器上报404 C#提取html中的汉字 MVC几种找不到资源的解决方式 使用Windows服务定时去执行一个方法的三种方式

    js replace 全局替换   js 的replace 默认替换只替换第一个匹配的字符,如果字符串有超过两个以上的对应字符就无法进行替换,这时候就要进行一点操作,进行全部替换. <scrip ...

  10. 封装PDO操作数据库

    <?php class DatabaseHandler { /** * sql语句查询 */ public static function query_data ($dataName,$sql, ...