I'm working with a vendor who is updating a file via SFTP every 12 hours. I'd like to automate the download of the file every time it is updated. When I run a batch script manually it works just fine. When I put it in the task scheduler with highest privileges it completes successfully but nothing happens.
In Task Scheduler I've set the action to 'start a program' using 'C:\Windows\System32\cmd.exe /c psftp2.bat' start in 'E:\stuff'.
Here is my script:
(echo cd "Complete List of Stuff"
echo get "stuffList.csv" "E:\stuff\stuffList.csv" ) | psftp -P 11011 verylong@username.com@withsftpaddress.org -pw somepassword -bc
robocopy "E:\stuff\" "\\otherserver\stuff$" stuffList.csv
I'm not sure where it's dying but I suspect the statement in parenthesis is what could be causing the problem.
The account I'm using to run the task has sufficient 'Logon as batch job' permissions.