为了方便用户查看交换机接口流量,客户又不会登录交换机,而且也没有网管流量统计设备,索性写了个vbs脚本,虽然简陋,也可以一用。
on error resume next dim WshShell Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.run"cmd" WshShell.AppActivate"d:\windows\system32\cmd.exe" WScript.Sleep 200 WshShell.SendKeys"telnet 10.1.1.1" WshShell.SendKeys"{ENTER}" WshShell.SendKeys"username" WshShell.SendKeys"{ENTER}" WshShell.SendKeys"password" WshShell.SendKeys"{ENTER}" WshShell.SendKeys"ena" WshShell.SendKeys"{ENTER}" WshShell.SendKeys"enable-password" WshShell.SendKeys"{ENTER}" WshShell.SendKeys"sh int summary | in ^\\* Giga|RXBS|TXBS|-" WshShell.SendKeys"{ENTER}" WshShell.SendKeys" " WshShell.SendKeys"{ENTER}"
红色为IP和用户名、密码等,注意修改。
保存以上文本为vbs,即可执行。需要提前打开telnet服务,兼容性未知,只测试过win10无问题。
本文出自 “菠萝味咖啡的领地” 博客,请务必保留此出处http://ccies.blog.51cto.com/717209/1716344
原文地址:http://ccies.blog.51cto.com/717209/1716344