Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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)


Topic review


PrivateKeyPassphrase - this option allowed me to specify the cert password
connection works now

WebDav over Powershell with 2 Factor auth


Perhaps someone could point me in the right direction. I'm trying to connect to a WebDav host using WinSCP & Powershell
Connecting to this WebDav host works 100% in the WinSCP client itself. i specify the location of the certificate, put the host address and remote directories in under advanced. when i then connect I am prompted for 2 passwords. First the certificate PW, then the user / pass for the webdav host itself.

I would now like to do this via powershell. I noticed that you can generate the session code from the client - see below
the generated code specified the webdav host username and the certificate password. The actual webdav host password is not specified.

# Load WinSCP .NET assembly
Add-Type -Path "WinSCPnet.dll"

# Set up session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::Webdav
HostName = ""
PortNumber = 443
UserName = "hostusername"
Password = "certificatepassword"
WebdavSecure = $True
TlsClientCertificatePath = "C:\OpenSSL-Win64\certificate"

$session = New-Object WinSCP.Session

# Connect

# Your code

In the end when I try to connect i get the following error

Exception calling "Open" with "1" argument(s): "SSL handshake failed, client certificate was requested: SSL error: sslv3 alert handshake failure
Connection failed."
At line:20 char:5
+ $session.Open($sessionOptions)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : SessionRemoteException

If it works with the client surely it can be done using the .net assembly and PS

thanks in advance for any help or suggestions