本帖最后由 zqq200808 于 2018-9-30 22:15 编辑
学习一下,给你贴一部分 我写的
[Visual Basic] 纯文本查看 复制代码 params=str.split(" ");
objTab.Session.Connect("/telnet " + params[0]);
objTab.Screen.WaitForString( "Password:");
objTab.Screen.Send(params[1] + "\r");
objTab.Screen.WaitForString( ">");
objTab.Screen.Send("super"+"\r");
objTab.Screen.WaitForString( "Password:");
objTab.Screen.Send(params[2] + "\r");
objTab.Screen.WaitForString( ">");
objTab.Screen.Send("sys"+"\r");
objTab.Screen.WaitForString( "]");
objTab.Session.LogFileName = "d:\\Config-BACKUP\\log\\"+params[3]+".log";
objTab.Session.Log(true);
//配置信息
objTab.Screen.Send("display current-configuration"+"\r");
objTab.Screen.Send(" ");
objTab.Screen.WaitForString( "]");
//版本信息
objTab.Screen.Send("display version"+"\r");
objTab.Screen.Send(" ");
objTab.Screen.WaitForString( "]");
//接口信息
objTab.Screen.Send("display interface brief "+"\r");
objTab.Screen.Send(" ");
objTab.Screen.WaitForString( "]");
//CPU信息
objTab.Screen.Send("display cpu"+"\r");
objTab.Screen.Send(" ");
objTab.Screen.WaitForString( "]");
//内存信息
objTab.Screen.Send("display memory"+"\r");
objTab.Screen.Send(" ");
objTab.Screen.WaitForString( "]");
//风扇信息
objTab.Screen.Send("display fan"+"\r");
objTab.Screen.Send(" ");
objTab.Screen.WaitForString( "]");
//硬件信息
objTab.Screen.Send("display device manuinfo"+"\r");
objTab.Screen.Send(" ");
objTab.Screen.WaitForString( "]");
objTab.Screen.Send("quit"+"\r");
objTab.Screen.WaitForString( ">");
//objTab.Session.LogFileName = "d:\\Config-BACKUP\\log\\"+params[0]+".log";
objTab.Session.Log(false);
objTab.Screen.Send("quit"+"\r");
objTab.Session.Disconnect(); |