Topic "Converting Scripting to VB Script"

Author Message
DirtyHarryNZ
[View user's profile]

Joined: 2015-04-14
Posts: 3
Location: New Zealand
Hi!

I apologize for the length of my post - just wanted to include all relevant information.

I have been using WinScp for about 4 years to perform a simple GET & PUT using the script method ie passing a batch file written in notepad to WinScp.exe - this works fine.
The accounting package I support uses VB script and I want to automate WinScp in real time so, I created a VB alternative but I cannot get past an error that says "Further Authentication Required". I compared the logs for the scripted version versus the VB version and they are identical in structure except for my mentioned error.

The error log says:

! 2015-04-14 11:55:50.832 Using username "username"
. 2015-04-14 11:55:50.879 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2015-04-14 11:55:50.879 Using stored password.
. 2015-04-14 11:55:50.879 Sent password
! 2015-04-14 11:55:50.941 Further authentication required
. 2015-04-14 11:55:50.941 Further authentication required
. 2015-04-14 11:55:50.941 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2015-04-14 11:55:50.941 Disconnected: Unable to authenticate


Here is my original script - that works fine.

###Get All Waiting Orders
option batch abort
option confirm off
open sftp://username:password -hostkey="ssh-rsa 2048 0000"
cd /OUT
option transfer ascii
get -delete *.xml d:\accredosaturn\scripts\bunn\inbox\
close
exit

This is my VB script - not working:

Dim SessionOptions as Object, Session As Object
Session=CreateObject("WinSCP.Session")
SessionOptions=CreateObject("WinSCP.SessionOptions")
Protocol=SessionOptions.Protocol
Protocol="Sftp"
SessionOptions.SshHostKeyFingerprint="ssh-rsa 2048 7d:33:b8:7b:cb:74:b6:92:85:8e:fa:f1:7e:fc:a7:df"
SessionOptions.HostName="ftp.site.com"
SessionOptions.UserName="username"
SessionOptions.Password="password"


Session.SessionLogPath="D:\Temp\Winscp.txt"
Session.Open(SessionOptions)
Session.Dispose


Any help would be HUGELY appreciated!

Kind Regards
Shayne Harris, New Zealand
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Can you attach both logs?
_________________
Martin Prikryl
DirtyHarryNZ
[View user's profile]

Joined: 2015-04-14
Posts: 3
Location: New Zealand
prikryl wrote:
Can you attach both logs?


Hi,

Sure-both logs attached.

I think I may have spotted the problem however, I have no idea how to fix it:

Working:
. 2015-04-15 13:25:01.175 Script: Retrospectively logging previous script records:
> 2015-04-15 13:25:01.175 Script: option batch abort
< 2015-04-15 13:25:01.175 Script: batch abort
< 2015-04-15 13:25:01.175 Script: reconnecttime 120
> 2015-04-15 13:25:01.175 Script: option confirm off
< 2015-04-15 13:25:01.175 Script: confirm off
> 2015-04-15 13:25:01.175 Script: open sftp://USER123:***@ftp.aos.com -hostkey="ssh-rsa 2048 7d:33:b8:7b:cb:74:b6:92:85:8e:fa:f1:7e:fc:a7:df"

VS

Not Working:
. 2015-04-14 11:39:39.030 Script: Retrospectively logging previous script records:
> 2015-04-14 11:39:39.030 Script: option batch on
> 2015-04-14 11:39:39.030 Script: batch on
< 2015-04-14 11:39:39.030 Script: reconnecttime 120
> 2015-04-14 11:39:39.030 Script: option confirm off
< 2015-04-14 11:39:39.030 Script: confirm off
> 2015-04-14 11:39:39.030 Script: option reconnecttime 120
< 2015-04-14 11:39:39.030 Script: reconnecttime 120
> 2015-04-14 11:39:39.030 Script: open sftp://USER123:***@ftp.aos.com -hostkey="ssh-rsa 2048 7d:33:b8:7b:cb:74:b6:92:85:8e:fa:f1:7e:fc:a7:df" -timeout=15


Thanks for your assistance!
SFTP-NOT-WORKING.txt (11.57 KB) [Download]

Description: Not-Working

SFTP-WORKING.txt (11.71 KB) [Download]

Description: Working

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
I do not see any difference either.
Add /loglevel=* to enable password logging and verify that the password used is the same in both cases.
_________________
Martin Prikryl
DirtyHarryNZ
[View user's profile]

Joined: 2015-04-14
Posts: 3
Location: New Zealand
prikryl wrote:
I do not see any difference either.
Add /loglevel=* to enable password logging and verify that the password used is the same in both cases.


Thanks Martin, that was it!

So simple I feel stupid!

Thanks again.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License