# Configure Automated File Transfer to Ascent360 Using WinSCP and Task Scheduler

This article will help you set up an automated file transfer using WinSCP, a free SFTP client for Windows. WinSCP can be used in conjunction with Windows Task Scheduler to automatically send files to Ascent360.

Download and install WinSCP and note the path of the install location. WinSCP should be downloaded on the same device you will be transferring files from and located in a folder accessible by all users.

Create a folder dedicated to staging files that should be transferred. Note the path of this folder.

You will also need to configure file exports to drop to this newly-created folder. This will be accomplished within the source system.

## Access the Ascent360 FTP with WinSCP

Open WinSCP

Login using the credentials provided to you by Ascent360. If you are unsure of your FTP login credentials, please reach out to support@ascent360.com

File Protocol: SFTP

Host Name: sftp://ftp.ascentcrm.com

Port Number: 22

User Name: Provided by Ascent360

On the resulting dialog, click Yes.

## Generate Command Line Transfer Arguments

Once logged in to WinSCP, you can use WinSCP to generate command line transfer arguments for you. To do so, please have a test file ready to transfer from your intended folder (preferably with the same naming convention and structure as the files you plan to regularly transfer).

On the left side of the program, you'll see your local directory. The Ascent360 FTP remote directory is located on the right. Navigate to your file in the local directory, right-click your file and select Upload

On the resulting window, select the Transfer Settings... drop-down, then Generate Code...

Under Script, ensure the Command Line format is selected.

Select Copy to Clipboard, then Close

## Edit the Transfer Arguments

Once you have generated templated arguments, open a text editor (like Notepad) and paste the text copied to the clipboard.

The resulting text should look like this (yours should remain all in one line).

/log="C:\writable\path\to\log\WinSCP.log" /ini=nul /command "open {{sftp account}}/ -hostkey=""{{hostkey}}""" 
"lcd ""C:\Users\admin\Desktop\Send to Ascent360""" "cd /" "put ""{{file}}""" "exit"


Replace the path of the log. It is recommended that you create a log file in the same location as the WinSCP Application. Using the example above, this text would change from:

/log="C:\writable\path\to\log\WinSCP.log"

to:

/log="C:\Users\admin\AppData\Local\Programs\WinSCP\WinSCP.log" /ini=nul ^


On the Put Command, change the text to appear as follows:

"put ""*.csv"" -delete"


This ensures that only files with the CSV file type will be uploaded regardless of the file title. Adding the -delete switch will delete the file from the local directory after successfully uploading to the Ascent360 FTP.

The final script should look similar to this:

/log="C:\Users\admin\AppData\Local\Programs\WinSCP\WinSCP.log" /ini=nul /command "open {{sftp account}}/ -hostkey=""{{hostkey}}"""
"lcd ""C:\Users\admin\Desktop\Send to Ascent360""" "cd /" "put ""*.csv"" -delete" "exit"


Keep this notepad open and proceed to the next step.

Select Action > Create Basic Task...

Name the task. Select Next >

Set the task to Begin On a schedule, Daily, Recur Every 1 days. Configure the task to run prior to midnight Mountain Time.

Please ensure that the system responsible for generating the files will complete the export prior to the set time for the Scheduled Task.

Under Action, select Start a program, then browse for the WinSCP.exe executable (program) and select it.

In Add arguments (optional), copy and paste the command line arguments from Notepad

Select Next >

On the final menu, enable Open the Properties dialog for this task when I click Finish

Select Finish

### Properties Window

On the General tab of the Properties Window, enable the following under Security Options:

• Run whether user is logged on or not
• Run with highest privileges

You may also want to change the user running the task to an Admin user to avoid permission issues.

On the Settings tab, enable the following:

• Run task as soon as possible after a schedule start is missed
• If the task fails, restart every 5 minutes, 3 times

## Test the Configuration

After setting up the scheduled task, select the task, then Run on the right side. If there are any .CSV files in the export folder, they should be uploaded to Ascent360 and subsequently deleted.