Scripting with WINSCP

I had a previous scheduled task to run once a week to securely transfer some files over an encrypted SCP connection.

For some reason the script has stopped working and not auto putting in the passphrase so it just timesout.

I think its down to an update in WINSCP which has depracated the auto passphrase addition.

But im not sure where to go with it now.

My script is:

cd "\Program Files (x86)\WinSCP"  "connection name"  /script="D:\data\SCRIPT\script1.txt"
cd "D:\data\outgoing\"
del /Q *.*

The contents of script1.txt is

mget *
rm *

mput *
timb551IT ManagerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gerwin Jansen, EE MVETopic Advisor Commented:
Can you verify that the stored credentials for "connection name" are still working? To to that start WinSCP.exe and try opening that "connection name", it should connect automatically. If it doesn't, re-enter the password and save the credentials again. Then retry your script.
timb551IT ManagerAuthor Commented:
When using the gui and selecting the connection name it prompts me for my passphrase.

I have tried saving my passphrase into the connection but it still doesnt go straight through.
Gerwin Jansen, EE MVETopic Advisor Commented:
When I save the passhrase I can use just the connection name in the script. You need to get that working first probably.
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

timb551IT ManagerAuthor Commented:
Are you saving a password or a passphrase.  There is a difference.  Im connecting using a private and public key which needs a passphrase.
Gerwin Jansen, EE MVETopic Advisor Commented:
The password is stored in a long encrypted string in the connection setting. The public key does not need a password, you trust the host upon the first connection. Where do you have to enter the passhrase then? For the client to connect you would only need the public key.
timb551IT ManagerAuthor Commented:
When you connect via scp or ssh it asks for the private key passphrase.

I cannot store it anywhere for it to auto fill in.
Gerwin Jansen, EE MVETopic Advisor Commented:
Were you using pagent before? Pagent can be used to (pre)load private keys that you then use in WinSCP to connect. Could it be that pagent is not running anymore or that it has not loaded the private key(s)?
timb551IT ManagerAuthor Commented:
dont think i was using pagent but i will investigate that now.  thanks
Gerwin Jansen, EE MVETopic Advisor Commented:
Small typo, its Pageant, in WinSCP, the setting is here:
using pageant

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
timb551IT ManagerAuthor Commented:
I defintley wasnt using Pageant before but i will try using it now.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SSH / Telnet Software

From novice to tech pro — start learning today.