为了方便用户查看交换机接口流量,客户又不会登录交换机,而且也没有网管流量统计设备,索性写了个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无问题。
时间: 2024-11-03 11:45:37