Connection to FTP over FTPS in PowerShell via WinSCP.dll

Advertisement

Mark Jenster
Joined:
Posts:
2

Connection to FTP over FTPS in PowerShell via WinSCP.dll

Hello.

I've tried to find some documentation about setting up FTPS in PowerShell via the WinSCP.dll. As you might have guessed, it wasn't a success. Same goes for a topic as this on the forum.

I know how to set the protocol to either SFTP, SCP or FTP. The problem here is that I need to use SSL to connect, which I don't know how to set up. The connection fails every time I try without it. The connection of course works when I use WinSCP directly, instead of PowerShell.

Any help on this topic would be appreciated.

Reply with quote

Advertisement

Mark Jenster
Joined:
Posts:
2

Did it. Thanks. Now my problem is that I get a "Connection failed." message.
Nothing more. I might need to make a new topic on this though, if I can't seem to find it in the forum.
Works fine with WinSCP as standalone, but gives some troubles in in PowerShell.

--EDIT
This is fixed by setting in
$sessionOptions.SslHostCertificateFingerprint = "[fingerprint]"

Reply with quote

Sara
Guest

Re: Connection to FTP over FTPS in Powershell via WinSCP.dll

Hello, I'm trying to do the same thing- launch FTPS with PowerShell.
I'm getting an error:
Exception setting "Protocol": "Cannot convert null to type "WinSCP.Protocol" due to enumeration values that are not
valid. Specify one of the following enumeration values and try again. The possible enumeration values are "Sftp, Scp, Ftp, Webdav"."
I have tried doing:
$sessionOptions.Protocol = [WinSCP.Protocol]::FtpSecure
$sessionOptions.Protocol = [WinSCP.Protocol]::FtpSecure.Implicit
Not sure what it wants? Just Ftp will not do FTPS right? Help please.

Reply with quote

Advertisement

ftps
Joined:
Posts:
1

cant figure out syntax

Was going to write a big long post about how this doesn't work but I just figured it out. The option is like this -ftpsecure explicit
$WinSCPSession = New-WinSCPSession -SessionOption (New-WinSCPSessionOption -HostName ftp.XXXXXX.net -Protocol ftp -Credential $Credential -ftpsecure explicit) -SessionLogPath c:\temp\upload.log
before was getting this, but that option fixes it.
< 2024-02-26 08:53:34.822 550-This server requires encryption.
< 2024-02-26 08:53:34.822 550 You must issue the AUTH command to change to an encrypted session before you can attempt to login.

Reply with quote

martin
Site Admin
martin avatar

Re: cant figure out syntax

@ftps: This topic is about WinSCP .NET assembly API. You are using a 3rd party WinSCP PowerShell module. It has its own distinct syntax.

Reply with quote

Advertisement

You can post new topics in this forum