VBScript for CRT.
Sometimes we have to perform the same change on many devices and instead of spending on it couple of hours we can use script to automate our task.
The easiest option is using VBScript, which can be used with CRT (popular telnet/ssh client). Below you can find an example of script which you can copy* and save as a script file. From CRT menu click ‘Script’->‘Run’ and select the file. I added some comments for those who are not familiar with the Visual Basic.
“# $language = "VBScript"
# $interface = "1.0"
GTAC_USERNAME = "username" <--set here the correct value
GTAC_SPASSWORD = "password" <--set here the correct value
G_ENABLEPASSWORD = "enable-password" <--set here the correct value
Sub Main
Dim IP(11) <-- in my example we have list of 11 devices
IP(0)="57.196.12.38"
IP(1)="57.196.12.39"
… <- complete the list of your devices
IP(10)="57.196.12.40"
For j=0 to 10 step 1
crt.Screen.Send "telnet " + IP(j) & vbcr
crt.Screen.WaitForString "Username:" <--set here the correct value
crt.Screen.Send GTAC_USERNAME & vbcr
crt.Screen.WaitForString "Password:" <--set here the correct value
crt.Screen.Send GTAC_SPASSWORD & vbcr
crt.Screen.Send "en" & vbcr
crt.Screen.WaitForString "Password:" <--set here the correct value
crt.Screen.Send G_ENABLEPASSWORD & vbcr
crt.Screen.Send "conf t" & vbcr
crt.Screen.Send "access-list 700 permit 60A1.DAE1.9C68 0000.0000.0000" & vbcr <-- in our case we have to add ACL
crt.Screen.Send "end" & vbcr
crt.Screen.Send "wr mem" & vbcr
crt.Screen.WaitForString "[OK]"
crt.Screen.Send "exit" & vbcr
Crt.Screen.WaitForString "linux :" <--set here the correct value of your hostname
Next
End Sub
*
You agree that the use of this code is at your own risk