#1
|
|||
|
|||
Do show command in Cisco cli
I'm trying to check for a specific configuration for each interface.
After I log in with telnet, this is my script ' When telnet session is opened successfully do the following ' Push the cli commands to the device crt.Screen.Synchronous = True strCommand = "show interface status" & vbCr crt.Screen.Send strCommand crt.Screen.WaitForString strCommand screenOut = crt.Screen.ReadString("#") tempArray = Split(screenOut, vbcr) For i = 2 to Ubound(tempArray)-1 interfaces = Split(tempArray(i)) strCommand = "show run interface "& interfaces(0) & vbCr crt.Screen.Send strCommand crt.Screen.WaitForString strCommand screenOut = crt.Screen.ReadString("#") objStream.WriteLine screenOut Next However, strCommand = "show run interface "& interfaces(0) & vbCr doesn't work in the Cisco cli. It shows up as two commands, but it's clearly one line. Output from Cisco cli uct-m60mike-desk-1#show interface status Port Name Status Vlan Duplex Speed Type Gi0/1 notconnect 2002 auto auto 10/100/1000BaseTX Gi0/2 notconnect 2002 auto auto 10/100/1000BaseTX Gi0/3 notconnect 2002 auto auto 10/100/1000BaseTX Gi0/4 notconnect 2002 auto auto 10/100/1000BaseTX Gi0/5 notconnect 2002 auto auto 10/100/1000BaseTX Gi0/6 notconnect 2002 auto auto 10/100/1000BaseTX Gi0/7 notconnect 2002 auto auto 10/100/1000BaseTX Gi0/8 notconnect 2002 auto auto 10/100/1000BaseTX Gi0/9 UCT-m50-l2-1 connected trunk a-full a-1000 10/100/1000BaseTX Gi0/10 disabled 1 auto auto Not Present uct-m60mike-desk-1#show run interface % Incomplete command. uct-m60mike-desk-1#Gi0/1 ^ % Invalid input detected at '^' marker. uct-m60mike-desk-1# |
#2
|
|||
|
|||
Hi retsam111,
I don't see anything wrong with your code either. I would just suggest you add a MsgBox() before sending strCommand and enclose it in angle brackets so you can see what's being sent for sure: MsgBox "<" & strCommand & ">"
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#3
|
|||
|
|||
Perhaps try replacing vbCr with vbCrLf as your delimiter?
|
#4
|
|||
|
|||
I did a little poking around and it seems that your script will start working if:
1) You change the vbCr to vbCrLf on just one line: Old Line: Code:
tempArray = Split(screenOut, vbCr) Code:
tempArray = Split(screenOut, vbCrLf) * I'm running this from a Windows PC, I'm not sure what you're on. |
#5
|
|||
|
|||
The delimiter was it, I changed it to vbCRLf and it worked. Thanks for the help.
|
![]() |
Tags |
cisco , show run |
Thread Tools | |
Display Modes | Rate This Thread |
|
|