cancel
Showing results for 
Search instead for 
Did you mean: 

one script for multiple routers

one script for multiple routers

Michael_Smalls
New Contributor
I am interested in a script that uses only a mac address in the format XX:XX:XX:XX:XX:XX OR XXXX.XXXX.XXXX to execute 5 static commands across multiple routers.

Essentially i want to be able to copy/paste a mac address for a program such as SecureCrt/Putty. After i paste the mac address i would like the following commands to execute on after the other

1. sh cab mod 'COPIED MAC ADDRESS'
2. sh cab mod 'COPIED MAC ADDRESS' conn
3. sh cab mod 'COPIED MAC ADDRESS' flap
4. sh cab mod 'COPIED MAC ADDRESS' cpe
5. sh ip arp

Is this possible. below is what is was able to come up with so far using script recorder in Secure Crt, upon that i don't know what else to do.

Problem 1
I would have to know what router the mac address is on to run the script. (i would like script to run all routers i have connected at one time) Note: if i have to do each router at a time that is ok if aforementioned is not possible and/or scripting to complex

Problem 2

Because mac address' are different and i have to manually input them i would mean that commands 2-5 would not execute if using script below.

I am sure that there is a way the edit script where after MAC ADDRESS is copied into command_1 , that same MAC ADDRESS will be place into subsequent commands 2-4. But i just don't know the programming language.

Can some please assist per below

#$language = "VBScript"#$interface = "1.0"

crt.Screen.Synchronous = True

' This automatically generated script may need to be
' edited in order to work correctly.

Sub Main
crt.Screen.Send "sh cab mod FF:FF:FF:FF:FF:FF" & chr(13)
crt.Screen.WaitForString "Switch>"
crt.Screen.Send "sh cab mod FF:FF:FF:FF:FF:FF conn" & chr(13)
crt.Screen.WaitForString "Switch>"
crt.Screen.Send "sh cab mod FF:FF:FF:FF:FF:FF flap" & chr(13)
crt.Screen.WaitForString "Switch>"
crt.Screen.Send "sh cab mod FF:FF:FF:FF:FF:FF cpe" & chr(13)
crt.Screen.WaitForString "Switch>"
crt.Screen.Send "sh ip arp " & chr(13)
End Sub
12 REPLIES 12

If u do use Cygwin to write script...will the script b able to work in a terminal emulator like putty? ...or it would mean I need Cygwin to use script

Actually, let me see if I can use cygwin. If so, this simple program is quite awesome.

https://www.cygwin.com/

I'm sorry. I got pulled away on something and forgot. Can you have access to a linux VM or something? I feel like I could write this much better using expect or something vs using perl for windows. Perl for windows is okay, but then you will have to install the perl ssh module and it just gets complicated.

r u still able to assist...i was reluctant to ask bcuz u r doing me a favor and i feel like i'm 'bugging' u

Michael_Smalls
New Contributor
ttt
GTM-P2G8KFN