Xshell Script does not Auto Login device [1]

Xshell Script does not Auto Login device

Monday, September 23, 2013 10:36 PM - le tian

My English is not good, briefly describe, I wrote a script that is executed as always pops up the password dialog box, you can not Auto Login device. Script as follows:

Sub Main
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso,file1,line,str1,params
Set fso = CreateObject("Scripting.FileSystemObject")
Set file1 = fso.OpenTextFile("D:\SWbackup\list1.txt",Forreading, False)
xsh.Screen.Synchronous = True
DO While file1.AtEndOfStream <> True
line = file1.ReadLine
params = Split (line)
xsh.Session.LogFilePath = "d:\SWbackup\log\" & params(0) & ".txt"
xsh.Session.StartLog
Dim host
host = params(1)
Dim user
user = params(2)
Dim password
password = params(3)
xsh.Session.Open "SSH://" & user & "@" & host
xsh.Screen.Send VbCr
xsh.Session.Sleep 100
xsh.Screen.waitForString "#"
xsh.Session.Sleep 100
str1 = "show config"
xsh.Screen.Send str1 & vbcr
xsh.Screen.waitForString "--- Press CTRL+C to quit ---"
xsh.Screen.Send " " & vbcr
xsh.Screen.waitForString "#"
xsh.Session.Sleep 100
xsh.Session.StopLog
xsh.Session.Close
loop
xsh.Screen.Synchronous = False
End Sub

Program Ver. : Xshell 4
Attachment ssh.vbs (1.1 KB)  


Re: Xshell Script does not Auto Login device

Wednesday, September 25, 2013 2:20 AM - Support

It looks like there is an error in our example script file. SSH protocol always opens up a dialog box due to different types of authentication methods that SSH offers.

Try using this script instead:

Sub Main
xsh.Session.Open "ssh://username:password@host"
xsh.Screen.Synchronous = true
End Sub

Please remember this will have your password in the script file.

---
Technical Support


Previous views: 152