Topic "Problem With Task Sceduler"

Author Message
Bubbo77
[View user's profile]

Joined: 2014-10-09
Posts: 3
Good Morning,

I'm new to Winscp Scripting, and i've got a problem with the automation of mi scripting.
My environment is simple i install an SSH server with Freesshd, and now i start to use winscp for transfer file on 22 Port in this server. If i use a script that i run with a .bat file manually with a double click than all work perfectly.
But if i use the Windows task scheduler, nonthing happens, i think it's simple because i start a program : mytransfer.bat and i click "esecute", but nothing...also if i wait the time for the schedule...

My script is run with a simple batch (mytransfer.bat)

@echo off
cd "C:\Program Files (x86)\WinSCP"
winscp.com /script=Upload.txt
exit

that lunch this simple file "Upload.txt":

# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect
open sftp://user@xx.xx.xx.xxx/ -hostkey="ssh-rsa 2048 ##:##:##:ecc..."
# Force binary mode transfer
option transfer binary
# Upload the file to current working directory
put c:\Uploadfile\*.*
# Disconnect
close
# Exit WinSCP
exit

Thank a lot for the support
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Please read documentation FAQ:
https://winscp.net/eng/docs/faq_scheduler

If that does not help, come back.
_________________
Martin Prikryl
Bubbo77
[View user's profile]

Joined: 2014-10-09
Posts: 3
Hi,

i tried to export the configuration winSCP.ini from Tools>export of the GUI.And the i tried to put winSCP.ini to the folder where is the executable Winscp.exe and i run the task scheduler from my Server Windows 2008 R2, but doesn't work, the same if i put the winSCP.ini to user profile Roaming folder. More over i add the folliwing command /ini to permit the batch to read where is the winSCP.ini file.
But nothing...
this is the Log that i receive:

! 2014-10-09 18:02:25.947 Using username "user".
. 2014-10-09 18:02:25.948 Prompt (7, SSH password, , &Password: )
. 2014-10-09 18:02:34.270 Sent password
. 2014-10-09 18:02:34.271 Password authentication failed
! 2014-10-09 18:02:34.271 Access denied
. 2014-10-09 18:02:34.271 Prompt (7, SSH password, , &Password: )
. 2014-10-09 18:02:35.948 Sent password
. 2014-10-09 18:02:35.949 Password authentication failed
! 2014-10-09 18:02:35.949 Access denied
. 2014-10-09 18:02:35.949 Prompt (7, SSH password, , &Password: )
. 2014-10-09 18:02:44.273 Disconnected: Unable to authenticate
. 2014-10-09 18:02:45.950 Disconnected: Unable to authenticate

i repeat that if i double click to the batch then works like a charm. Sad

and i receive this LOG

. 2014-10-09 18:05:39.096 Trying Pageant key #0
! 2014-10-09 18:05:39.096 Authenticating with public key "rsa-key-20141009" from agent
. 2014-10-09 18:05:39.173 Sending Pageant's response
. 2014-10-09 18:05:39.175 Access granted
. 2014-10-09 18:05:39.175 Opening session as main channel

I hope your going to help me!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
You are authenticating with Pageant which is running in a different session than the scheduler. So WinSCP cannot communicate with Pageant.
You need to specify a private key explicitly in the script.
Bubbo77
[View user's profile]

Joined: 2014-10-09
Posts: 3
prikryl wrote:
You are authenticating with Pageant which is running in a different session than the scheduler. So WinSCP cannot communicate with Pageant.
You need to specify a private key explicitly in the script.


Hi there!

it's correct if i change my script in this way ?

# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect
open sftp://user@xx.xx.xx.xxx/ -privatekey=mykey.ppk"
# Force binary mode transfer
option transfer binary
# Upload the file to current working directory
put c:\Uploadfile\*.*
# Disconnect
close
# Exit WinSCP
exit


Could you explain it to me in more detail?
I'm sorry but I'm not very handy with these concepts.

Thanks a lot!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Yes, that is correct, except for the unmatched double-quote.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
I have documented the issue with Pageant on:
https://winscp.net/eng/docs/faq_scheduler
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License