Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

As per my previous post:
please post your new code and corresponding log file
GHarlam

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?
martin

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.
GHarlam

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