Log on to the Cisco switch and run the command

Source: Internet
Author: User
Tags cisco switch
In many cases, we may need to log on to the Cisco switch to execute some common viewing commands, but it is troublesome to run cmd, enter the password, and enter the command.

The discovery can be achieved through batch processing, as shown in figureLog on to the Cisco switch 192.168.0.1 and Ping another switch 192.168.0.2.

The script is as follows:

@ Echo off
Echo Set Sh = Wscript. Createobject ( " Wscript. Shell " ) > Telnet_tmp.vbs
Echo wscript. Sleep 300   > Telnet_tmp.vbs
Echo Sh. sendkeys " Open 192.168.0.1 "   > Telnet_tmp.vbs
Echo wscript. Sleep 300   > Telnet_tmp.vbs
Echo Sh. sendkeys " {Enter} "   > Telnet_tmp.vbs
Echo wscript. Sleep 300   > Telnet_tmp.vbs
Echo Sh. sendkeys " Root {enter} " > Telnet_tmp.vbs
Echo wscript. Sleep 300   > Telnet_tmp.vbs
Echo Sh. sendkeys " Your_password {enter} " > Telnet_tmp.vbs
Echo Sh. sendkeys " Ping 192.168.0.2 {enter} "   > Telnet_tmp.vbs
Start Telnet
Cscript // Nologo telnet_tmp.vbs
Echo del telnet_tmp.vbs

 

The Ping result is displayed immediately.

However, sometimes we want users to perform some tests and directly send the execution results to us in text;
This requiresRedirect debugging results to text filesPlease let me know about this. Thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.