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

Michael_Smalls
New Contributor
ok i just quick checked and yes perl will work, i just will need the PerlScript engine

Michael_Smalls
New Contributor
i don't know if SecureCrt/Putty can run perl scripts but i can try if i had a script

Jeremy_Gibbs
Contributor
If you can use perl, I will write you a simple perl script to do what you want. I write scripts like these all the time. You can also use Expect! to do some automation, although it does suck.
GTM-P2G8KFN