Converting Scripting to VB Script

Advertisement

DirtyHarryNZ
Joined:
Posts:
3
Location:
New Zealand

Converting Scripting to VB Script

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

Reply with quote

Advertisement

DirtyHarryNZ
Joined:
Posts:
3
Location:
New Zealand

Re: Converting Scripting to VB Script

martin 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!
Description: Not-Working
Description: Working

Reply with quote

martin
Site Admin
martin avatar

Re: Converting Scripting to VB Script

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.

Reply with quote

DirtyHarryNZ
Joined:
Posts:
3
Location:
New Zealand

Re: Converting Scripting to VB Script

martin 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.

Reply with quote

Advertisement

You can post new topics in this forum