Need help setting SslMode.Implicit in PowerShell

+1 vote
asked Aug 4, 2015 by shunt01 (240 points)

Hi All,

I have alot of PowerShell scripts that use Rebex.Net.sFtp but now have a need to use Rebex.Net.Ftp. The site that I am connecting to requires us to use Port 990 (SSL/TLS Implicit) I have found examples where is says to use connect(hostname, SslMode.Implicit) but when I do that in PowerShell it does not like the second argument. Does anyone know how to handle in PowerShell?

Thank You in Advance,
Scott

1 Answer

+1 vote
answered Aug 5, 2015 by Tomas Knopp (58,890 points)
selected Aug 5, 2015 by shunt01
 
Best answer

Hello Scott,

thanks for using Rebex products!

Here is a powershell script that connects to the Ftp server on port 990 with implicit TLS/SSL mode:

Add-Type -Path "c:\Program Files (x86)\Rebex Components 2015 R3.1\bin\net-4.0\Rebex.Ftp.dll"

$ftp = New-Object Rebex.Net.Ftp
$ftp.Connect("test.rebex.net", [Rebex.Net.SslMode]::Implicit)
$ftp.Login("demo", "password")
$ftp.Disconnect()

FYI, Rebex.Net.SslMode is an enum, working with enums from PowerShell is a bit tricky and is discussed e.g. at this Microsoft site.

commented Aug 5, 2015 by shunt01 (240 points)
Thanks Tomas! That worked.
...