Topic "Error when executing WinSCP from SSIS Execute Process task"

Author Message
DNDAUGHTERY

Guest


Hey guys, I'm getting the following error when I try to run my package which contsins only an execute process task calling WinSCP.

Error: [Execute Process Task] Error: In Executing "C:\Program Files (x86)\WinSCP\WinSCP.exe " ""/script=C:\SFTP.txt"" at "C:\Program Files (x86)\WinSCP", The process exit code was "1" while the expected was "0".

Process task settings:
Executable: C:\Program Files (x86)\WinSCP\WinSCP.exe
Arguments: "/script=C:\SFTP.txt"
Working Directory: C:\Program Files (x86)\WinSCP
rest are default values

SFTP.txt code is as follows:
option batch on
option confirm off
open sftp://User:Password@My.Server.com:22
cd /foldername/foldername/foldername/foldername
option transfer binary
get *.csv \\Servername\foldername\foldername\foldername\foldername\
close
exit

Any ideas where I'm making my mistake?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Add /log=c:\path\to\winscp.log switch to WinSCP command line and attach it here.

See https://winscp.net/eng/docs/troubleshooting#scripting
dotps1
[View user's profile]
Contributor
Joined: 2015-03-23
Posts: 15
Location: United States
DNDAUGHTERY wrote:
Hey guys, I'm getting the following error when I try to run my package which contsins only an execute process task calling WinSCP.

Error: [Execute Process Task] Error: In Executing "C:\Program Files (x86)\WinSCP\WinSCP.exe " ""/script=C:\SFTP.txt"" at "C:\Program Files (x86)\WinSCP", The process exit code was "1" while the expected was "0".

Process task settings:
Executable: C:\Program Files (x86)\WinSCP\WinSCP.exe
Arguments: "/script=C:\SFTP.txt"
Working Directory: C:\Program Files (x86)\WinSCP
rest are default values

SFTP.txt code is as follows:
option batch on
option confirm off
open sftp://User:Password@My.Server.com:22
cd /foldername/foldername/foldername/foldername
option transfer binary
get *.csv \\Servername\foldername\foldername\foldername\foldername\
close
exit

Any ideas where I'm making my mistake?


a quick look to me and you have double quotes in your args as well as a space after WinSCP.exe, I would remove the quotes from Arguments: "/script=C:\SFTP.txt" and the trailing space so your actual cmdline looks like this:
Code:
"C:\Program Files (x86)\WinSCP\WinSCP.exe" "/script=C:\SFTP.txt"
rather then
Code:
"C:\Program Files (x86)\WinSCP\WinSCP.exe " ""/script=C:\SFTP.txt""

_________________
https://github.com/dotps1
Dan2

Guest


> 2016-02-23 09:24:11.640 Script: option confirm off
< 2016-02-23 09:24:11.640 Script: confirm off
> 2016-02-23 09:24:11.640 Script: open sftp://MyUsername:***@MySFTP.Server.com:22
. 2016-02-23 09:24:11.640 --------------------------------------------------------------------------
. 2016-02-23 09:24:11.640 Session name: MyUsername@MySFTP.Server.com (Ad-Hoc site)
. 2016-02-23 09:24:11.640 Host name: MySFTP.Server.com (Port: 22)
. 2016-02-23 09:24:11.640 User name: MyUsername (Password: Yes, Key file: No)
. 2016-02-23 09:24:11.640 Tunnel: No
. 2016-02-23 09:24:11.640 Transfer Protocol: SFTP
. 2016-02-23 09:24:11.640 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2016-02-23 09:24:11.640 Disable Nagle: No
. 2016-02-23 09:24:11.640 Proxy: none
. 2016-02-23 09:24:11.640 Send buffer: 262144
. 2016-02-23 09:24:11.640 SSH protocol version: 2; Compression: No
. 2016-02-23 09:24:11.640 Bypass authentication: No
. 2016-02-23 09:24:11.640 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2016-02-23 09:24:11.640 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2016-02-23 09:24:11.640 KEX: dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN
. 2016-02-23 09:24:11.640 SSH Bugs: A,A,A,A,A,A,A,A,A,A,A,A
. 2016-02-23 09:24:11.640 Simple channel: Yes
. 2016-02-23 09:24:11.640 Return code variable: Autodetect; Lookup user groups: A
. 2016-02-23 09:24:11.640 Shell: default
. 2016-02-23 09:24:11.640 EOL: 0, UTF: 2
. 2016-02-23 09:24:11.640 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2016-02-23 09:24:11.640 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2016-02-23 09:24:11.640 SFTP Bugs: A,A
. 2016-02-23 09:24:11.640 SFTP Server: default
. 2016-02-23 09:24:11.640 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2016-02-23 09:24:11.640 Cache directory changes: Yes, Permanent: Yes
. 2016-02-23 09:24:11.640 DST mode: 1
. 2016-02-23 09:24:11.640 --------------------------------------------------------------------------
. 2016-02-23 09:24:11.640 Looking up host "MySFTP.Server.com"
. 2016-02-23 09:24:11.703 Connecting to 555.555.555.555 port 22
. 2016-02-23 09:24:11.781 Server version: SSH-2.0-XFB.Gateway Unix
. 2016-02-23 09:24:11.781 Using SSH protocol version 2
. 2016-02-23 09:24:11.781 We claim version: SSH-2.0-WinSCP_release_5.7.6
. 2016-02-23 09:24:11.812 Using Diffie-Hellman with standard group "group1"
. 2016-02-23 09:24:11.812 Doing Diffie-Hellman key exchange with hash SHA-1
. 2016-02-23 09:24:12.654 Verifying host key rsa2 0x10001,0xc67021649eb498a4 8afe3f2c9d2fbf50 5b27bcb455e57200 bfdcd76d81c8bafe f76203726f7c2443 de684000316b2aca e271cad639ed6707 f2b1ec16edf7b822 a39a5499e13abbdb 3886059910bd9659 d31e009512f80ee2 3918ddf0bceb5381 81148f9185176a8b 79dda18f5e349838 3c5c47fadd0d4aa8 b6930cee529b8777 with fingerprint ssh-rsa 1024 4c:7d:06:34:f0:56:b2:7b:ad:5b:25:48:4d:91:85:36
. 2016-02-23 09:24:12.654 Host key matches cached key
. 2016-02-23 09:24:12.654 Host key fingerprint is:
. 2016-02-23 09:24:12.654 ssh-rsa 1024 4c:7d:06:34:f0:56:b2:7b:ad:5b:25:48:4d:91:85:36
. 2016-02-23 09:24:12.654 Initialised AES-256 SDCTR client->server encryption
. 2016-02-23 09:24:12.654 Initialised HMAC-SHA1 client->server MAC algorithm
. 2016-02-23 09:24:12.654 Initialised AES-256 SDCTR server->client encryption
. 2016-02-23 09:24:12.654 Initialised HMAC-SHA1 server->client MAC algorithm
! 2016-02-23 09:24:12.717 Using username "MyUsername".
. 2016-02-23 09:24:12.898 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2016-02-23 09:24:12.898 Using stored password.
. 2016-02-23 09:24:12.898 Sent password
. 2016-02-23 09:24:13.616 Received disconnect message (host not allowed to connect)
. 2016-02-23 09:24:13.616 Disconnection message text: ssh disconnect host not allowed to connect
. 2016-02-23 09:24:13.616 Server sent disconnect message
. 2016-02-23 09:24:13.616 type 1 (host not allowed to connect):
. 2016-02-23 09:24:13.616 "ssh disconnect host not allowed to connect"
dndaughtery

Guest


BTW, we are able to connect using filezilla using that user and password
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
dndaughtery wrote:
BTW, we are able to connect using filezilla using that user and password

Are you sure you use SFTP, and not FTP (or FTPS) with FileZilla?
Show us a FileZilla log file (a real log file, not a message log from the GUI).
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