Privatekey not accessible via Task scheduler

Advertisement

legionnl
Guest

Privatekey not accessible via Task scheduler

Goodday,

i have a batch file with a script in it using WINSCP 5.7.5.

the upload script is quite basic:
open sftp://username@servername:2222 -privatekey=Privatekey.ppk -passphrase=@password
lcd E:\Projectdata\projectname\Export\Processed\

put *.txt

exit    

if i activate the batch file with the serviceaccount used by task scheduler there is no problem.
howeever if i activate it via taskscheduler i get the following error in the log file

. 2015-10-08 14:01:20.669 Reading private key file "Privatekey.ppk"
. 2015-10-08 14:01:20.669 Unable to use this key file (unable to open file)
! 2015-10-08 14:01:20.669 Unable to use key file "Privatekey.ppk" (unable to open file)
! 2015-10-08 14:01:20.669 Using username "username".
. 2015-10-08 14:01:20.810 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2015-10-08 14:01:30.841 Disconnected: Unable to authenticate

Any help would be appreciated,
Legionnl

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: Privatekey not accessible via Task scheduler

I assume the startup directory of the batch file is different to the directory the private key file is contained in. Use a full path to the private key.

Reply with quote

legionnl
Guest

unfortunately no. all files are in the same folder. Batch file, scriptfile,scriptlog and Privatekey.

however it was the solution to this problem thank you very much.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

legionnl wrote:

unfortunately no. all files are in the same folder. Batch file, scriptfile,scriptlog and Privatekey.
That does not contradict my claim that the startup directory of the script is different.

Reply with quote

Advertisement

You can post new topics in this forum