VBS script to backup Cisco configs

Discussion in 'Computer Support' started by thefunnel@aol.com, Dec 1, 2005.

  1. Guest

    Hello,

    I need some assistance on a script I am writing. Its purpose is to
    backup running-config files from Cisco switches via telnet and TFTP.

    I need to address the following problems...

    1. All the DOS windows open at once, I would like them to open in
    order.
    2. All the uploaded file names are identical. Hence the previous ones
    are overwritten
    3. I would like the script to read from a text file of IPs

    Any pointers in the right direction would be appreciated.

    Many thanks.

    @echo off
    echo set sh=WScript.CreateObject("WScript.Shell")>telnet.vbs
    echo WScript.Sleep 500>>telnet.vbs
    echo sh.SendKeys "password">>telnet.vbs
    echo sh.SendKeys "~">>telnet.vbs
    echo sh.SendKeys "en">>telnet.vbs
    echo sh.SendKeys "~">>telnet.vbs
    echo sh.SendKeys "password">>telnet.vbs
    echo sh.SendKeys "~">>telnet.vbs
    echo sh.SendKeys "copy running-config tftp://192.168.0.1">>telnet.vbs
    echo sh.SendKeys "~">>telnet.vbs
    echo sh.SendKeys "~">>telnet.vbs
    echo sh.SendKeys "~">>telnet.vbs
    echo sh.SendKeys "exit">>telnet.vbs
    echo sh.SendKeys "~">>telnet.vbs

    start /realtime telnet.exe 192.168.0.10 (first device)
    cscript.exe //nologo telnet.vbs

    start /realtime telnet.exe 192.168.0.11 (second device)
    cscript.exe //nologo telnet.vbs

    del telnet.vbs
     
    , Dec 1, 2005
    #1
    1. Advertising

  2. why? Guest

    x-post cut to 24HSHD from
    comp.dcom.sys.cisco,microsoft.public.scripting.vbscript,microsoft.public.scripting.wsh,24hoursupport.helpdesk

    On 1 Dec 2005 04:44:09 -0800, thefunnel wrote:

    Perl / Net::Telnet::Cisco module , that's all I use. Do the login bit,
    send the command and capture the output to a file.

    >Hello,
    >
    >I need some assistance on a script I am writing. Its purpose is to
    >backup running-config files from Cisco switches via telnet and TFTP.
    >
    >I need to address the following problems...
    >
    >1. All the DOS windows open at once, I would like them to open in
    >order.


    So what.

    >2. All the uploaded file names are identical. Hence the previous ones
    >are overwritten


    My perl script constructs unique names for files, oddly enough
    date-time-device-name.txt

    >3. I would like the script to read from a text file of IPs


    Perl does better than that, you enter IPs as ranges in the script, or do
    it in a file if you prefer using a list of addresses.

    Say your base IP is 192.168.12.x

    The devices are .1 to .8 , .15 and then .20 to .25

    (1..8,15,20..25)

    You construct the full IP from the base value + the range in a foreach
    loop

    http://www.developertutorials.com/tutorials/cgi-perl/perl-range-operator-050616/page1.html



    >Any pointers in the right direction would be appreciated.
    >
    >Many thanks.
    >

    <snip>

    Me
     
    why?, Dec 1, 2005
    #2
    1. Advertising

  3. why? Guest

    x-post cut again,


    Not forgetting Kiwi CatTools, standard tool for anyone using Cisco kit,
    and several other brands.

    You can automate config backups.

    On 1 Dec 2005 04:44:09 -0800, wrote:

    >Hello,
    >
    >I need some assistance on a script I am writing. Its purpose is to
    >backup running-config files from Cisco switches via telnet and TFTP.
    >
    >I need to address the following problems...
    >
    >1. All the DOS windows open at once, I would like them to open in
    >order.

    <snip>

    Me
     
    why?, Dec 1, 2005
    #3
  4. garethb Guest

    Hi

    I don't know how to do this, but there is a great freeware tool which
    achieves the same http://www.kiwisyslog.com/cattools2.htm I works really
    well for me.

    Regards
    --
    Gareth Brown | Consultant | 1E Ltd | www.1e.com

    <> wrote in message
    news:...
    > Hello,
    >
    > I need some assistance on a script I am writing. Its purpose is to
    > backup running-config files from Cisco switches via telnet and TFTP.
    >
    > I need to address the following problems...
    >
    > 1. All the DOS windows open at once, I would like them to open in
    > order.
    > 2. All the uploaded file names are identical. Hence the previous ones
    > are overwritten
    > 3. I would like the script to read from a text file of IPs
    >
    > Any pointers in the right direction would be appreciated.
    >
    > Many thanks.
    >
    > @echo off
    > echo set sh=WScript.CreateObject("WScript.Shell")>telnet.vbs
    > echo WScript.Sleep 500>>telnet.vbs
    > echo sh.SendKeys "password">>telnet.vbs
    > echo sh.SendKeys "~">>telnet.vbs
    > echo sh.SendKeys "en">>telnet.vbs
    > echo sh.SendKeys "~">>telnet.vbs
    > echo sh.SendKeys "password">>telnet.vbs
    > echo sh.SendKeys "~">>telnet.vbs
    > echo sh.SendKeys "copy running-config tftp://192.168.0.1">>telnet.vbs
    > echo sh.SendKeys "~">>telnet.vbs
    > echo sh.SendKeys "~">>telnet.vbs
    > echo sh.SendKeys "~">>telnet.vbs
    > echo sh.SendKeys "exit">>telnet.vbs
    > echo sh.SendKeys "~">>telnet.vbs
    >
    > start /realtime telnet.exe 192.168.0.10 (first device)
    > cscript.exe //nologo telnet.vbs
    >
    > start /realtime telnet.exe 192.168.0.11 (second device)
    > cscript.exe //nologo telnet.vbs
    >
    > del telnet.vbs
    >
     
    garethb, Dec 11, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    14,078
    garethb
    Dec 11, 2005
  2. dleve50
    Replies:
    0
    Views:
    505
    dleve50
    Apr 29, 2005
  3. Sako
    Replies:
    9
    Views:
    1,442
    Arnold Nipper
    Aug 10, 2006
  4. Fei
    Replies:
    5
    Views:
    1,030
    Ben Myers
    Apr 1, 2007
  5. Fei
    Replies:
    1
    Views:
    715
    thanatoid
    Mar 31, 2007
Loading...

Share This Page