SFTP Further Auth required
Hi Guys,
I'm trying to connect to a remote server via SFTP
The credentials work in a GUI session but I get the below error in my script.
Any assistance would be appreciated
Ryan
I'm trying to connect to a remote server via SFTP
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
Ryan