Home » Automating SFTP Downloads using WinScp Free Tool

Automating SFTP Downloads using WinScp Free Tool

sql server DBA 999

Today’s article is about how to Automating SFTP Downloads using WinScp Free Tool:

This will be helpfull in many situations of which one is if you have your database hosted in Cloud by Hosted Services then for running reports etc. linking this database to another which is hosted locally, would mean you will need to automate SFTP downloads for that database and run restore script to Restore Database Automatically.


1. Install the WinScp Free Tool.
2. Access your FTP Site using SFTP(I used implicit FTP). If you cant access this then check your Firewall and see if this is blocked. Add exceptions to Firewall as needed.
3. Store a Session inside WinScp with Login and password credentials for Automating Downloads from FTP Site.
How to fix SQL server SFTP 2
How to fix SQL server SFTP
4. Run the above stored Session to see that it connects successfully.
5. Create a Schedule Task for Running a Program on Schedule as

"C:Program Files (x86)WinSCPWinSCP" /script=C:SQL-BackupBackupScript.txt

where “C:Program Files (x86)WinSCPWinSCP” is pointing to application
and /script=C:SQL-BackupBackupScript.txt is pointing to Script for Download as

option batch on
option confirm off
open [email protected]
get /CloudDB_BackUp.bak C:SQL-Backup
7. Run the task

8. The Backup should now be successfully downloaded to C:SQL-Backup folder.

Troubleshooting Tips:

If needed run the same script from CMD prompt.
First go to the location of program
cd C:Program Files (x86)WinSCPWinSCP

next run the Script
WinSCP /script=C:SQL-BackupBackupScript.txt

Leave a Reply

Your email address will not be published. Required fields are marked *