CRT bulk Backup Network device script

Source: Internet
Author: User


Batch backup of network device scripts with VBS scripts via SECURECRT Telnet

Use: Open SecureCRT and select script to run this script to

This script calls the e:/device backup/ip.txt file in this file format: IP address user name password device name


# $language  =  "VBScript" # $interface  =  "1.0" CRT. screen.synchronous = truesub mainconst forreading = 1forwriting =  2forappending = 8dim wordkeydim fsodim file1dim linedim paramsset fso  = createobject ("Scripting.FileSystemObject") Set file1=fso. OpenTextFile ("E:\ device backup \ip.txt", forreading,false) ' file format:ip  user name   password   device name While file1. Atendofstream <> true ' reads the file line = file1 by line. readlineparams = split  (line) CRT. session.connect  "/telnet"  &  " "  & params (0) ' equivalent &NBSP;TELNET&NBSP;IP address  23crt. session.logfilename =  "e:/device backup/"  + params (3)  + replace (replace (replace (date,   ":",  ""),  "/",  ""),  " ",  ")  + " _log.txt "CRT. Session.log truewordkey = crt. screen.waitforstrings  ("Username:", "Login:", "Username:", 3) &NBSP;&NBSP; ' Select  select case wordkeycase 1crt in 3 seconds based on the login prompt. Screen.send params (1) &NBSP;&AMP;&NBSP;CHR (CRT). screen.waitforstring  "passcode:" CRT. Screen.send params (2) &NBSP;&AMP;&NBSP;CHR (CRT). screen.waitforstring  "#" CRT. screen.send  "Show run" &NBSP;&AMP;&NBSP;CHR (while ) (Crt. Screen.waitforstring ("--more--", 3) = true) CRT. screen.send  " " WENDCASE&NBSP;2CRT. Screen.send params (1) &NBSP;&AMP;&NBSP;CHR (CRT). screen.waitforstring  "password: " CRT. Screen.send params (2) &NBSP;&AMP;&NBSP;CHR (CRT). screen.waitforstring  ">" CRT. screen.send  "Dis cu" &NBSP;&AMP;&NBSP;CHR (while ) (Crt. Screen.waitforstring ("---- More ----", 3) = true) CRT. screen.send  " " &NBSP;WENDCASE&NBSP;3CRT. Screen.send params (1) &NBSP;&AMP;&NBSP;CHR (CRT). screen.waitforstring  "Password:" CRT. Screen.send params (2) &NBSP;&AMP;&NBSP;CHR (CRT). screen.waitforstring  ">" CRT. screen.send  "DIS&NBsp;cu "&NBSP;&AMP;&NBSP;CHR (while ) (Crt. Screen.waitforstring ("---- More ----", 3) = true) CRT. screen.send  " " wendend selectcrt.session.disconnectwendcrt.screen.synchronous =  Falseend sub


CRT bulk Backup Network device script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.