The purpose of this tutorial is to demonstrate how to upload to the GK12 server using the WinSCP console. This is necessary to understand because it is via the console that one can schedule a task for automatic uploads. This is easiest using Windows PowerShell. The first thing that is needed is a batch file that contains all of the commands that the console needs to read. This just eliminates a bunch of typing in the command line, thus minimizing the chances for mistakes.
- In your favorite text editor, make a file that looks like the following and save it as a .bat Name the file FileUpload.bat.
The first three lines should stay the same. Change yourWinSCPusername to the username assigned to your district.
In the line with the put command, replace “c:\yourpath” with the local path to the file you wish to upload to the server. Make sure the name of your file is students_current.csv or the automated system will not recognize it.
- Create a second batch file. Name the file OpenConnection.ps1. (The PS1 extension will call Powershell.)
Again, change c:\yourpath to the local path where FileUpload.bat from step 1 was stored.
- Open Task Scheduler and choose Create Basic Task. Set Triggers to the specific time schedule you want to upload files.
a. Name the task and enter a description similar to the one below.
b. Click Next
c. Choose when you want the task to start and click Next.
d. Choose how often the task should run.
e. Select Start a Program, Next.
f. Enter “powershell” as the program/script and the your path/OpenConnection.ps1 in Add arguments, click Next, and Finish.
**Test your new task by running it from the Task Scheduler console. You may need to change the security options to a local system account with administrative rights if the task will not run on demand or automatically.
You have now successfully uploaded a file to the GuideK12 server using the WinSCP console.