FTPS Explicit TLS .NET Libarary
Sorry for the rogue posting.
John
Hello, I'm having an issue connecting to a FTPS site using Explicit TLS encryption through the .Net Library through Powershell.
This is a new problem and first time I've tried using FTPS with Explicit TLS. WHen I use the GUI interface, I am able to connect.
When I go through the powershell code, I get an unable to connect exception.
Here is my code:
$winSCPathDLL = $global:appSettings["WinSCPDLL"] $winSCPDLLPath = $winSCPath + $winSCPathDLL [Reflection.Assembly]::LoadFrom($winSCPDLLPATH) #| Out-Null # Setup session options $sessionOptions = New-Object WinSCP.SessionOptions $sessionOptions.Protocol = [WinSCP.Protocol]::ftp $sessionOptions.FtpMode = [WinSCP.FtpMode]::passive $sessionOptions.FtpSecure = [WinSCP.FtpSecure]::explicittls $sessionOptions.HostName = $global:appSettings["FTPHost"] $sessionOptions.PortNumber = $global:appSettings["FTPPortNumber"] $sessionOptions.UserName = $global:appSettings["FTPUser"] $sessionOptions.Password = $global:appSettings["FTPPassword"] $session = New-Object WinSCP.Session $transferOptions = New-Object WinSCP.TransferOptions $transferOptions.TransferMode = [WinSCP.TransferMode]::Binary $session.Open($sessionOptions) #<<< Exception throw here
When I load the assembly, I get this:
GAC Version Location
--- ------- --------
False v2.0.50727 D:\ServiceOrders\Script\WinSCP\WinSCPnet.dll
I downloaded the latest .Net DLL today, so I have version 5.5.1.0
The exception details I can get to :
Connection failed.
At D:\Script.ps1:167 char:3
+ $session.Open($sessionOptions)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SessionRemoteException
+ FullyQualifiedErrorId : SessionRemoteException
I'm sure I must be missing something, but I am at a loss for finding it.
Thank you for the help.
John