SecureCRT自动备份脚本-思科
利用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自动备份脚本-思科的更多相关文章
- SecureCRT自动备份脚本-华为
# $language = "VBScript" # $interface = "1.0" Sub Main Const ForReading = 1, For ...
- Windows环境下Oracle数据库的自动备份脚本
批处理文件(.bat) @echo off echo ================================================ echo Windows环境下Oracle数据 ...
- 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 ...
- Mysql 自动备份脚本
转自: Mysql 自动备份脚本2 - - ITeye技术网站http://kangh.iteye.com/blog/2309091 备份方案: 备份主机:192.168.10.11 数据库服务器:1 ...
- oracle expdp自动备份脚本
windows: @echo off echo ================================================ echo Windows环境下Oracle数据库的自动 ...
- Oracle自动备份脚本的实现
问题描述: Oracle自动备份脚本的实现. 错误提示1: Message file RMAN.msb not found Verify that Oracle_HOME is set properl ...
- MySQL binlog 自动备份脚本
MySQL binlog 自动备份脚本 1 利用shell进行备份 #!/bin/sh #mysql binlog backup script /usr/local/mysql/bin/mysqlad ...
- Oracle数据库的自动备份脚本
@echo off echo ================================================ echo Windows环境下Oracle数据库的自动备份脚本 echo ...
- Windows环境下Oracle数据库的自动备份脚本自动删除30天前的备份
@echo off echo ================================================ echo Windows环境下Oracle数据库的自动备份脚本 echo ...
随机推荐
- Fresco的使用<一>
版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[+] 引入Fresco dependencies { // 添加依赖 compile 'com.facebook.fresco:fre ...
- dom4j的xpath查找xml的指定节点
递归遍历所有节点http://blog.csdn.net/sidihuo/article/details/47318723 获取Document SAXReader saxReader = new S ...
- SD 卡PIN定义
转载:http://blog.sina.com.cn/s/blog_56e19aa70101avnw.html SD卡和TF卡接口引脚定义
- Python中cv2库和matplotlib库色彩空间排布不一致
今天在python中读如图片时发现以下问题: 1.在from matplotlib import pyplot as plt之后,再import cv2 cv2.imshow()不能正常使用,还不知道 ...
- nginx使用指南
1.执行nginx 能够执行nginx命令开启nginx: nginx 假设nginx已经开启了,能够执行nginx命令加-s 參数来控制nginx的执行 nginx -s signal signal ...
- caffe学习--cifar10学习-ubuntu16.04-gtx650tiboost--1g--01
引用了下文的资料,在此感谢! http://www.cnblogs.com/alexcai/p/5468164.html http://blog.csdn.net/garfielder007/arti ...
- shell脚本定时任务 ( linux系统)
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbGV5YW5nanVu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA ...
- LookAround开元之旅
http://blog.csdn.net/lancees/article/details/17696805
- codeforces Looksery Cup 2015 H Degenerate Matrix
The determinant of a matrix 2 × 2 is defined as follows: A matrix is called degenerate if its determ ...
- 九度OJ 1089:数字反转 (数字反转)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3059 解决:1678 题目描述: 12翻一下是21,34翻一下是43,12+34是46,46翻一下是64,现在又任意两个正整数,问他们两个 ...