Error setting Session protocol to FTP

Advertisement

GHarlam
Joined:
Posts:
2
Location:
US

Error setting Session protocol to FTP

I'm trying to connect to an FTP server using PowerShell.

When I set the session parameters, it won't allow FTP:
# Load the WinSCP .NET assembly
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"
 
# Initialize a new WinSCP session
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = Protocol.Ftp
    HostName = "myftp.com" # Your remote host
    UserName = "myname"
    Password = "mypass"
}

My original syntax was this:
Protocol = [WinSCP.Protocol]::ftp
When I check the value of the protocol after, it is always SFTP.
Not sure what I'm doing wrong.

Any thoughts?

Thanks in advance!
Gary

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,852
Location:
Prague, Czechia

Re: Error setting Session protocol to FTP

The Protocol.Ftp won't even compile.
The [WinSCP.Protocol]::Ftp is correct (lowercase ftp is acceptable too).
When I run your code with Protocol = [WinSCP.Protocol]::ftp, the log shows:
. 2024-05-02 08:44:27.298 Transfer Protocol: FTP
If you still have problems, please post your new code and corresponding log file.

Reply with quote

GHarlam
Joined:
Posts:
2
Location:
US

Per my original post, I tried that first.
I changed the syntax based on what I found in other posts - I figured I'd try it.

Any other thoughts?

Reply with quote

Advertisement

You can post new topics in this forum