secure crt vbs脚本出问题,日志只能保存最后一台设备的查年看信息,之前的会被覆盖掉
我这个问题是,我登录多台设备,但在日志文件里总是显示的是最后一台设备的查看信息,之前的设备信息没有应是被覆盖掉了,在CRT里选了追加到日志文件里也不行的(默认是覆盖日志文件)。不知是怎回事。有那位大侠知道啊 ,脚本如下:# $language = "VBScript"
# $inte易做图ce = "1.0"
Sub Main
IpArray=ReadToArray("IP.txt")
For i=0 To Ubound(IpArray)-1
Concmd="/telnet"+" "+IpArray(i)
crt.session.Connect(Concmd)
crt.sleep 900
crt.Screen.Send "root" & vbCR
crt.sleep 900
crt.Screen.Send "admin" & vbCR
crt.sleep 1000
crt.Screen.Send "enable" & vbCR
crt.sleep 900
crt.Screen.Send "config" & vbCR
crt.sleep 900
crt.session.LogFileName = "c:\a.txt"
crt.session.Log true
crt.sleep 900
crt.Screen.Send " display mac-address all" & vbCR
crt.Screen.Send " " & vbCR
Do while (crt.Screen.WaitForString("--- More",2)<>False)
crt.Screen.Send " "
Loop
crt.session.Log false
crt.session.disconnect
Next
End Sub
Function ReadToArray(filespec)
Const ForReading = 1
Dim fso, theFile,i,RetString
Dim retArray()
Set fso = CreateObject("Scripting.FileSystemObject")
IF fso.FileExists(filespec) THEN
Set theFile = fso.OpenTextFile(filespec, ForReading,false,false)
i = 0
Do While theFile.AtEndOfStream <> True
RetString = Trim(theFile.ReadLine)
IF IsNull(RetString) <> True THEN
ReDim Preserve retArray(i+1)
retArray(i) = RetString
i=i+1
END IF
Loop
theFile.Close
ReadToArray = retArray
ELSE
ReadToArray= Null
MsgBox "配置文件无IP地址"+filespec
crt.session.Log false
END IF
End Function
没人啊。。。汗。。 我也出现类似情况 不知道和crt版本一样不
补充:VB , 网络编程