Re: Did you resolve this
@george338: And I have the same answer for you: Please post session log files both from the code and GUI. Did you use GUI to generate your code template?
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = "sftp"
SshHostKeyFingerprint = "ssh-rsa 2048 ######c1mPs7MODjkyCxawY+wIAn1m7UmV4NdPE="
HostName = "ftp.site.co.uk"
UserName = "username"
Password = "pass"
}
$session = New-Object WinSCP.Session
# Connect
$session.Open($sessionOptions)
Exception calling "Open" with "1" argument(s): "Connection has been unexpectedly closed. Server sent command exit status 0.
Authentication log (see session log for details):
Using username "excanf".
Further authentication required
Authentication failed."
At C:\secure-file-transfer-project\Powershell-Scripts\CR_Stockfile_Import.ps1:22 char:9
+ $session.Open($sessionOptions)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : SessionRemoteException