Xshell Forum

Telnet Script For Backup a CISCO

Last post: Monday, March 21, 2016 1:33 PM by NandDigital, 2 reply

 
Monday, February 29, 2016 2:21 PM - Rene

Telnet Script For Backup a CISCO

 
Hello guys,
I recently downloaded your application and do not know how can make a script that is connected to a CISCO through TELNET with user and password and execute a command; (show configuration) and store the result in to TXT file, and jump to another IP and repeat the same process, in order to automatized a maintenance.

Thanks you guys for your time and help.

Program Ver. : Xshell 5
Thursday, March 3, 2016 8:30 AM - zoo

Re: Telnet Script For Backup a CISCO

 
Here is a sample script for your job.

Sub Main

DIM servers, loopno
servers = Array("telnet://user1:passwd1@server1","telnet://user2:passwd2@server2", "telnet://user3:passwd3@server3")
serverNo = Ubound(servers)
loopno = 0
Do
While TRUE
if(loopno = serverNo +1 ) then
exit do
end if

xsh.Session.Open(servers(loopno))
xsh.Screen.Synchronous = false
xsh.Session.Sleep(1000)

'*** StartLog, StopLog ***
xsh.Session.LogFilePath = "d:\"&xsh.Session.RemoteAddress&"-%t.log"
xsh.Session.StartLog()

xsh.Screen.Send("ls"&vbcr)
xsh.Session.Sleep(1000)

xsh.Session.StopLog()
xsh.Session.Close()
xsh.Session.Sleep(1000)
loopno = loopno + 1

Wend
Loop

End Sub

The results are saved to log files.
Monday, March 21, 2016 1:33 PM - NandDigital

Re: Telnet Script For Backup a CISCO

 
thanks for the help.

but I cant see how insert the commands: ENABLE and then SHOW RUN in order to save the Reuters configuration.

Thanks again