Topic "Connecting to SFTP server using ppk file instead of password"

Author Message
lankso
[View user's profile]

Joined: 2016-12-05
Posts: 2
Hi Guys,

Wonder if someone can please point me in the right direction for a powershell script that will allow me to connect to a folder on a SFTP server, download a file and delete it off the server.

Having a bit of trouble piecing together ones I find online.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26299
Location: Prague, Czechia
WinSCP GUI can generate the script for you:
https://winscp.net/eng/docs/ui_generateurl#code
lankso
[View user's profile]

Joined: 2016-12-05
Posts: 2
Hi Guys,

I am getting the following error after generating the code.
I am able to connect fine on WinSCP, however need to script the download of files. Any ideas?

Exception calling "Open" with "1" argument(s): "Connection has been unexpectedly closed.
Server sent command exit status 0.
Authentication log (see session log for details):
Using username "nwcomputing".
Authenticating with public key "rsa-key-********".
Authentication failed."
At C:\Users\NWAdmin\Downloads\Win\Download.ps1:19 char:5
+ $session.Open($sessionOptions)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Smile [], MethodInvocationException
+ FullyQualifiedErrorId : SessionRemoteException
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26299
Location: Prague, Czechia
Please attach a complete session log file both from the GUI and the code.
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