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,

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("", [Rebex.Net.SslMode]::Implicit)
$ftp.Login("demo", "password")

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.
commented Jun 15, 2020 by anonymous
We have been using Rebex to upload and download files using  Recently one of our client is switching to TLS 1.2.  I tried to use the client.Connect(hostname, SslMode.Explicit)
 and I'm getting error message "Sslmode" is not declared.
Is there a library I need to include? Te version of rebex we have is 4  yrs old.  
Is there a sample code that I can use fopr TLS1.2 ?
commented Jun 15, 2020 by Lukas Pokorny (126,870 points)
Rebex.Net.SslMode enum has been available since 2012. Make sure you reference Rebex.Ftp.dll, Rebex.Networking.dll and Rebex.Common.dll from your application and try recompiling it then.