WinSCP won't be started on server using script

Advertisement

jliu
Joined:
Posts:
2

WinSCP won't be started on server using script

Hi,
We want to run WinSCP on Windows server 2016 twice a day for downloading reports from FTP site. We created a task scheduler(See the screenshot I uploaded) for the automation and confirmed the task was triggered successfully. However, it didn't call up WinSCP. The weird thing is I was able to run it manually in command prompt, but when I used task scheduler if wouldn't work.. Can someone please help?
The batch file is below
cd E:\Shares\FTP\
mkdir %date:~-10,2%"-"%date:~7,2%"-"%date:~-4,4%
cd C:\Program Files (x86)\WinSCP\
Winscp.com /ini=nul /script=dlscript.txt /log=ftpdownload.txt
exit


The script is below:
open sftp://pbuevh01:Apiscap90!@sfx.gs.com/ -hostkey="ssh-dss 1024 92:69:0e:64:a2:04:92:a4:49:17:3c:5c:e0:1b:59:93"
# Change remote directory
cd /outgoing
# Force binary mode transfer
option transfer binary
# Download file to the local directory E:\Shares\FTP\
#cd E:\Shares\FTP\%TIMESTAMP#mm-dd-yyyy%\
mget *.* E:\Shares\FTP\%TIMESTAMP#mm-dd-yyyy%\
# Disconnect
close
exit

task scheduler.PNG

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,540
Location:
Prague, Czechia

Re: WinSCP won't be started on server using script

jliu wrote:

However, it didn't call up WinSCP.
This is rather vague. Is any log file (ftpdownload.txt) generated? Probably not, as you seem to try to write it to C:\Program Files (x86)\WinSCP, where the task probably won't have a write access to. Try using an absolute path to a writable folder.

Reply with quote

jliu
Joined:
Posts:
2

This is the log, it says can't create files in the path. I confirmed the service account has full access permission and it is a domain admin account

. 2018-05-02 23:15:48.983 File: '/outgoing/SRPB_197358_1200556382_CFD_AggSumm_286772_164654_20180430.pdf' [2018-05-01T02:46:01.000Z] [181272]
. 2018-05-02 23:15:48.983 Copying "/outgoing/SRPB_197358_1200556382_CFD_AggSumm_286772_164654_20180430.pdf" to local directory started.
. 2018-05-02 23:15:48.983 Binary transfer mode selected.
. 2018-05-02 23:15:48.983 Checking existence of partially transferred file.
. 2018-05-02 23:15:48.983 Opening remote file.
> 2018-05-02 23:15:48.983 Type: SSH_FXP_OPEN, Size: 93, Number: 9987
< 2018-05-02 23:15:48.983 Type: SSH_FXP_STATUS, Size: 17, Number: 9484
. 2018-05-02 23:15:48.983 Discarding reserved response
< 2018-05-02 23:15:48.983 Type: SSH_FXP_STATUS, Size: 17, Number: 9732
. 2018-05-02 23:15:48.983 Discarding reserved response
< 2018-05-02 23:15:48.999 Type: SSH_FXP_HANDLE, Size: 45, Number: 9987
> 2018-05-02 23:15:48.999 Type: SSH_FXP_FSTAT, Size: 49, Number: 10248
< 2018-05-02 23:15:48.999 Type: SSH_FXP_ATTRS, Size: 70, Number: 10248
* 2018-05-02 23:15:48.999 (EOSError) System Error. Code: 3.

* 2018-05-02 23:15:48.999 The system cannot find the path specified
. 2018-05-02 23:15:48.999 Asking user:
. 2018-05-02 23:15:48.999 Can't create file 'E:\Shares\FTP\test\05-02-2018\SRPB_197358_1200556382_CFD_AggSumm_286772_164654_20180430.pdf.filepart'. ("System Error. Code: 3.

. 2018-05-02 23:15:48.999 The system cannot find the path specified")
< 2018-05-02 23:15:48.999 Script: Can't create file 'E:\Shares\FTP\test\05-02-2018\SRPB_197358_1200556382_CFD_AggSumm_286772_164654_20180430.pdf.filepart'.
< 2018-05-02 23:15:48.999 Script: System Error. Code: 3.

< 2018-05-02 23:15:48.999 The system cannot find the path specified
> 2018-05-02 23:15:48.999 Type: SSH_FXP_CLOSE, Size: 45, Number: 10500
* 2018-05-02 23:15:49.015 (ESkipFile) Can't create file 'E:\Shares\FTP\test\05-02-2018\SRPB_197358_1200556382_CFD_AggSumm_286772_164654_20180430.pdf.filepart'.
* 2018-05-02 23:15:49.015 System Error. Code: 3.
* 2018-05-02 23:15:49.015 The system cannot find the path specified
. 2018-05-02 23:15:49.015 Copying finished: Transferred: 0, Elapsed: 0:00:00, CPS: 0/s
. 2018-05-02 23:15:49.015 Script: Failed
. 2018-05-02 23:15:49.015 Script: Exit code: 1
. 2018-05-02 23:15:49.015 Closing connection.
. 2018-05-02 23:15:49.015 Sending special code: 12
. 2018-05-02 23:15:49.015 Sent EOF message

Reply with quote

Guest

No, E:\ is not a mapped drive, it is one of volume no the server. I've also tried download to C:\ but I am getting the same error

< 2018-05-03 08:30:16.556 Type: SSH_FXP_ATTRS, Size: 70, Number: 11528
* 2018-05-03 08:30:16.556 (EOSError) System Error. Code: 3.

* 2018-05-03 08:30:16.556 The system cannot find the path specified
. 2018-05-03 08:30:16.556 Asking user:
. 2018-05-03 08:30:16.556 Can't create file 'C:\FTP\05-03-2018\SRPB_197358_1200556382_CFD_AggSumm_286772_164654_20180430.pdf.filepart'. ("System Error. Code: 3.

. 2018-05-03 08:30:16.556 The system cannot find the path specified")
< 2018-05-03 08:30:16.556 Script: Can't create file 'C:\FTP\05-03-2018\SRPB_197358_1200556382_CFD_AggSumm_286772_164654_20180430.pdf.filepart'.
< 2018-05-03 08:30:16.556 Script: System Error. Code: 3.

< 2018-05-03 08:30:16.556 The system cannot find the path specified
> 2018-05-03 08:30:16.556 Type: SSH_FXP_CLOSE, Size: 45, Number: 11780
* 2018-05-03 08:30:16.556 (ESkipFile) Can't create file 'C:\FTP\05-03-2018\SRPB_197358_1200556382_CFD_AggSumm_286772_164654_20180430.pdf.filepart'.
* 2018-05-03 08:30:16.556 System Error. Code: 3.
* 2018-05-03 08:30:16.556 The system cannot find the path specified
. 2018-05-03 08:30:16.556 Copying finished: Transferred: 0, Elapsed: 0:00:00, CPS: 0/s
. 2018-05-03 08:30:16.556 Script: Failed
. 2018-05-03 08:30:16.556 Script: Exit code: 1
. 2018-05-03 08:30:16.556 Closing connection.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,540
Location:
Prague, Czechia

If you try to write to that drive directly in your batch file, does it work?

Like:
echo something > C:\FTP\somefile.txt

Reply with quote

Advertisement

You can post new topics in this forum