Unsolved
This post is more than 5 years old
2 Intern
•
128 Posts
0
43377
August 12th, 2005 15:00
PowerConnect 33xx - Saving the Running config via script
Does anyone use scripts to save configurations?
I would like to save the Running Config to the Startup config via a vbscript if possible.
I would like to save the Running Config to the Startup config via a vbscript if possible.
No Events found!


DELL-Cuong N.
1K Posts
0
August 15th, 2005 14:00
Mithrilhall
2 Intern
•
128 Posts
0
August 15th, 2005 14:00
Is there any way you could post a very generic script (perl/shell/or any other scripting language)?
DELL-Cuong N.
1K Posts
0
August 15th, 2005 19:00
I use Perl scripts mostly for my work but I can't easily send it to you since it is pretty large - it handles alot of different cases generically so I can do testing on different CLI commands (its not written specifically for doing backup) and to use it you must install have Cygwin, Expect and Perl. I tried to user perlcc to compile it so I can send it to you but it still requires link to cygwin DLLs. Anyway instead of going down this path (which is more time then I have at the moment :-)), I decided to write up a very simple script you can use with "Teraterm Pro" (you can get it here: http://hp.vector.co.jp/authors/VA002416/teraterm.html) that you can use as an example. You will need to expand on its capability (read the help for teraterm macro language) to include command line options and stuff like that so you can automate your script. You can then easily add it to windows scheduler to schedule your download if you want.
You can do similar thing using Perl and Expect but its really beyond my scope to explain Expect here. You may be able to do similar things in vbscript but I don't know vbscript so I can't help there.
Anyway here is the ttermpro script. You can run this script using ttpmacro.exe (part of the teraterm package). The ttpmacro has a command line interface that let you pass it a script (pass it the script I'm describing below) or you can double-click on ttpmacro.exe and it will prompt you for the script to run. The scripting language in tterm is pretty simple but powerful enough to do what you need I'm sure.
Here is the script below (note lines begining with ; are comments):
; Script for backing up running config.
; The script assumes the following prompts are used by the switch. You may need to adjust the prompt if you changed the
; name of the switch. Also I'm assuming that the account you are using to login will immediately put you in global priviledge mode.
; This should be true if the account is level 15. Global priviledge mode has a prompt of something like console# instead of console>.
; This means that I don't need to execute an enable first to get into the priviledge level to execute the copy command. If this is not true
; then you may need to add an enable first.
CommandPrompt = "console#"
; The following is the prompt for user name during login. Since some switch may prompt as "Username:" and some as "User Name:"
; it is safer to use "ame:" for the prompt.
UsernamePrompt = "ame:"
; This is the password prompt which maybe "Password:" or "password:"
PasswordPrompt = "assword:"
; You can make these parameters command line arguments quite easily.
; This script assumes that you have a TFTP server at 10.30.2.178.
TFTPServer = "10.30.2.178"
; It assumes that you are trying to connect to the switch at 10.30.2.177.
SwitchIP = "10.30.2.177"
; It assumes that the login and password are as follows. Note that tterm allow you to store the password encrypted in a file locally (see doc)
Username = "admin"
Password = "admin"
; Let's login to the switch
connect SwitchIP
wait UsernamePrompt
sendln Username
wait PasswordPrompt
sendln Password
; Once we login we can execute the copy command
; I'm assuming the name of the backup file is always backupfile but you can also take it from command line.
wait CommandPrompt
sendln "copy running-config tftp://"TftpServer"/backupfile"
wait CommandPrompt
sendln "exit"
Mithrilhall
2 Intern
•
128 Posts
0
August 15th, 2005 19:00
I'll download Teraterm but have been using Reflection. I'll give Teraterm a try. I know Reflection also has scripting capabilities so I'll give that a shot as well.
I'll have to learn Perl one of these days if I ever get a free moment.
Mithrilhall
2 Intern
•
128 Posts
0
September 21st, 2005 19:00
use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=>10,Errmode=>'die');
$output = $telnet->open('xxx.xxx.xxx.xxx');
$telnet->waitfor('/User name: $/i');
$telnet->print('bilbo');
$telnet->waitfor('/Password: $/i');
$telnet->print('baggins');
$telnet->waitfor('/\$ $/i');
$telnet->print('sh bridge address-table');
$output = $telnet->waitfor('/\$ $/i');
print $output;
The error I'm getting is:
pattern match timed-out at C:\Perl\eg\telnet.pl line 5
Any suggestions?
Mithrilhall
2 Intern
•
128 Posts
0
December 13th, 2005 19:00
andoven
1 Rookie
•
24 Posts
0
July 18th, 2008 15:00
I want to setup a script that I can kick off weekly to download the PC configs of all my switches. I'm not a programmer. What would the best tool be for me to accomplish this? I could use the format of the tera term sequence to copy the config to my ftp server. I was hoping I could setup an automated ftp from my ftp server to pull the configs out of each switch. Let me know what tool would be good to use for accomplishing this.
Thanks !