I am unable to download any files using SSIS (Execute Process Task) and Winscp. I followed various forums and was able to create a SSIS package. I am not sure where I am going wrong.
Steps I followed:-
Execute Process Task :-
i) In Executable I wrote "C:\Program Files (x86)\WinSCP\WinSCP.exe"
ii)In Arguments :- /script=C:\Users\abcd\Desktop\efgh\remotelocal.txt
iii) Working directory :- C:\Users\abcd\Desktop\efgh (I believe this is required for the location where file needs to be saved)
In Remotelocal.txt I have the following script:-
option batch abort
option confirm off
open ftpes://ghteyeriygvs:%69%315694598665@00.000.000.000/ (this is dummy value)
option transfer binary
cd ./wfgh/
get *.* C:\Users\abcd\Desktop\egfh
close
exit
On Executing this package I get following error
[Execute Process Task] Error: In Executing "C:\Program Files (x86)\WinSCP\WinSCP.exe" "/script=C:\Users\abcd\Desktop\efgh\remotelocal.txt" at "C:\Users\abcd\Desktop\efgh", The process exit code was "1" while the expected was "0".
get *.* C:\Users\abcd\Desktop\egfh
Hm. I'm not sure if that's a valid command. It may need to be:
get *.* C:\Users\abcd\Desktop\egfh\
Or:
lcd C:\Users\abcd\Desktop\egfh\
get *.*
However, the problem with troubleshooting this is that it's WinSCP throwing the error. That error cannot be logged by SSIS, but you can tell WinSCP to create a log.
In SSIS, in the Execute Process Task, change the arguments for WinSCP from this:
/script=C:\Users\abcd\Desktop\efgh\remotelocal.txt
To something like this:
/script=C:\Users\abcd\Desktop\efgh\remotelocal.txt /xmllog="M:\SSIS\Alexandria Patron Export\WinSCPLog.xml"
I choose the XML log over the standard log because the standard log is much more verbose and harder to see what's going on. If you want that log instead, try:
/script=C:\Users\abcd\Desktop\efgh\remotelocal.txt /log="M:\SSIS\Alexandria Patron Export\WinSCPLog.log"
Now try running your package and see what errors are logged by WinSCP.