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

aksarben

Re: Got Correct .NET Assembly (I Think)

Got it working now. Thanks!
aksarben

Got Correct .NET Assembly (I Think)

I re-read the doc page another 2-3 times, and I think I finally understand what you were saying.

Anyway, I changed my WINSCP_PATH environment variable to point to the newly installed DLL in the netstandard2.0 folder, and re-launched my PowerShell script.

I no longer get the message about the bad constructor arguments. Now I get a different error message (which I is assume is good news, because it indicates I have a different DLL).

The new error message:
Write-Error: Exception calling "Open" with "1" argument(s): "SessionOptions.Protocol is Protocol.Sftp or Protocol.Scp, but SessionOptions.SshHostKeyFingerprint is not set."

I'm trying to connect to an OpenSSH server on my PC for testing. Where do I get the SshHostKeyFingerprint the message refers to?
aksarben

Re: Session Open Command Is Failing

I don’t understand. What is the “.NET Standard build”? Where I can I get it?
aksarben

Session Open Command Is Failing

I’m writing a PowerShell script for WinSCP automation, and it’s failing on the session.open(). The code:
$sessionOptions
 
$session.open($sessionOptions)   # Connect to server

The content of $sessionOptions:
Name                                         : Dick@Solomon

Protocol                                     : Sftp
HostName                                     : Solomon
PortNumber                                   : 0
UserName                                     : Dick
Password                                     : xxx [masked for security]
SecurePassword                               : System.Security.SecureString
NewPassword                                  :
SecureNewPassword                            :
Timeout                                      : 00:00:15
TimeoutInMilliseconds                        : 15000
PrivateKeyPassphrase                         :
SecurePrivateKeyPassphrase                   :
RootPath                                     :
Secure                                       : False
SshHostKeyFingerprint                        :
SshHostKeyPolicy                             : Check
GiveUpSecurityAndAcceptAnySshHostKey         : False
SshPrivateKeyPath                            :
SshPrivateKey                                :
SshPrivateKeyPassphrase                      :
FtpMode                                      : Passive
FtpSecure                                    : None
WebdavSecure                                 : False
WebdavRoot                                   :
TlsHostCertificateFingerprint                :
GiveUpSecurityAndAcceptAnyTlsHostCertificate : False
TlsClientCertificatePath                     :

The error message:
Write-Error: Exception calling "Open" with "1" argument(s): "Method not found: 'Void System.Threading.EventWaitHandle..ctor(Boolean, System.Threading.EventResetMode, System.String, Boolean ByRef, System.Security.AccessControl.EventWaitHandleSecurity)'."

What am I doing wrong?