Scheduled uploads with & without RSA key using task scheduler

Advertisement

gcefaloni
Joined:
Posts:
4
Location:
Canada

Scheduled uploads with & without RSA key using task scheduler

Hi,

I'm trying to schedule an upload of the latest .csv file that has been created to 2 sftp remote servers, one that using RSA private key and the other that doesn't, using the task scheduler but it doesn't seem to work for me. I was wondering if you guys could help me out.

For server that DOESN'T use Private RSA Key:
Script.txt
# I copied that from Generate Script Code within WinSCP
open sftp://ftpuser:password@ftp.example.ca/ -hostkey="ssh-rsa 2048 00-000-0-0-00-0=" -rawsettings ProxyPort=0 (the port for the server is 22, should I change that even if it was autogenerated script based on the working settings?)

lcd C:\Users\myuser\Dropbox\Portfolio\Position Files\
put *.csv /From_Me/ latest -nopreservetime

exit

Task Scheduler Action
Program/Script
"C:\Program Files (x86)\WinSCP\WinSCP.exe"

Arguments:
/log="C:\Users\Gab\Dropbox\Nymbus Bonds\Portfolio\Logs\position_file.log" /ini=nul /script="C:\Users\Gab\Dropbox\Nymbus Bonds\Portfolio\position_file_script.txt"
__________________________________________________________________________

For server that DOES use Private RSA Key:
Script.txt
# I copied that from Generate Script Code within WinSCP
open sftp://user@sftp.server2.com/ -hostkey="ssh-ed25519 256 00-000-000-000-000-000=" -privatekey="C:\Users\myuser\Dropbox\ssh-private-key.ppk" -rawsettings AgentFwd=1 GSSAPIFwdTGT=1 ProxyPort=1 (the port for the server is 22, should I change that even if it was autogenerated script based on the working settings?)

lcd C:\Users\myuser\Dropbox\Portfolio\Position Files\
put *.csv /From_Me/ latest -nopreservetime

exit
Task Scheduler Action
Program/Script
"C:\Program Files (x86)\WinSCP\WinSCP.exe"

Arguments:
/log="C:\Users\Gab\Dropbox\Nymbus Bonds\Portfolio\Logs\position_file.log" /ini=nul /script="C:\Users\Gab\Dropbox\Nymbus Bonds\Portfolio\position_file_script.txt"

Is there something I need to do differently in each scenario of with or without RSA private key for it work when I run the task scheduler? Right now it shows as task completed but nothing actually uploads to the remote servers. I've tried while keeping the application opened or keeping it closed. Either way, it doesn't work for the moment. Any suggestions for modifications?

Thank you!

Reply with quote

Advertisement

gcefaloni
Joined:
Posts:
4
Location:
Canada

Re: Scheduled uploads with & without RSA key using task scheduler

martin wrote:

Show us the log please.

The log for task scheduler? How would I go about doing that?

Reply with quote

martin
Site Admin
martin avatar

Re: Scheduled uploads with & without RSA key using task scheduler

Well, you enable logging to a file:
/log="C:\Users\Gab\Dropbox\Nymbus Bonds\Portfolio\Logs\position_file.log"
So please post that file.

Reply with quote

Guest

Re: Scheduled uploads with & without RSA key using task scheduler

Log file is attached
  • session.log (41.56 KB, Private file)
Description: log file

Reply with quote

Advertisement

gcefaloni
Joined:
Posts:
4
Location:
Canada

Changed it to :

open sftp://ftpNymbus:***@ftp.**.ca/ -hostkey="ssh-rsa 2048 AAiK4+*/XTrC/w3ik7IKHs=" -rawsettings ProxyPort=0

put -latest -nopreservetime "C:\Users\Gab\Dropbox\Nymbus Bonds\Portfolio\Position Files\*.csv" "/To_Folder/"

close

exit

I think it might work better that way?

Reply with quote

gcefaloni

If I wanted to use the same script to connect to a SFTP that uses a privatekey with a password. What should I modify so that the password of the privatekey is automatically entered?

Reply with quote

Advertisement

You can post new topics in this forum