Winscp Script for wth passphrase

Advertisement

mrashid
Joined:
Posts:
2

Winscp Script for wth passphrase

Hello all
Need urgent help
i need to transfer the file to remote (UNIX) server , authentication is through the PPK with passphrase,
i have pageant running and added the key , and in current session batch file is working,
however when i run as batch file thru scheduler it is not working,and it is executing with the same user added the key pageant, and it is asking key to add it in pageant everytime it is login.

has any body done the automation , if yes please share the ideas at the earliest

Reply with quote

Advertisement

mrashid
Joined:
Posts:
2

Re: Winscp Script for wth passphrase

hi

(using -privatekey and -passphrase switches)
-passphrase switch is not working, I have downloaded 5.7.6
could you provide the sample script , so it will help in automation script

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,276
Location:
Prague, Czechia

Re: Winscp Script for wth passphrase

Please attach a full log file showing the problem (using the latest version of WinSCP).

To generate log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

knowme
Guest

Re: Winscp Script for wth passphrase

I was able to get this to work with the current version (5.7.4), without the need for the -passphrase switch. This is used in a batch script, and the passphrase is passed to winscp using the echo command:
echo yourpassphrase|winscp /command ^
  "option confirm off" ^
  "option transfer binary" ^
  "open sftp://username:password@server.com -privatekey=C:path\privatekey.PPK" ^
  "cd /out" ^
  "get testfile*" ^
  "exit"
Hope this helps,

Matt

Reply with quote

Advertisement

edtguy
Joined:
Posts:
1
Location:
New Jersey

Re: Winscp Script for wth passphrase

I have solved this in an SSIS package that needs to transmit a file. In the package, I have created an Execute Process task to run WinSCP. I have created a variable in the package to store the private key's passphrase. As part of the command line arguments, I entered /parameter // {passphrase}
In the session's script file, I have an open statement with the arguments -privatekey={privateKeylocation} -passphrase=%2
It is %2 because it is the second /parameter argument on my command line.
Hope that helps.

Reply with quote

Advertisement

You can post new topics in this forum