Type 11 Disconnect when trying to use GetFileToDirectory
Hi,
I'm trying to download a file from an SFTP Server to a local fileserver using the
Here's the basic script that I am using:
When I try to run just this it sometimes works and sometimes it doesn't. In the full script it never works. This is the error that I receive:
I'm trying to download a file from an SFTP Server to a local fileserver using the
GetFileToDirectory
method. I am using the DLL Version 6.3.5.0 in PowerShell to do that.
Here's the basic script that I am using:
$winSCPPath = "D:\Path\To\DLL" Add-Type -Path $winSCPPath [string]$script:sftpServer = "xxxxx" [string]$script:username = "xxxxx" [string]$script:password = "xxxxx" [string]$script:fingerprint = "xxxxx" [int]$script:port = xxxxx $securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force $scplogpath = "$PSScriptRootFix\logs\script.log" $remotePath = "/Path/To/Remote/File.msi" $localPath = "\\fileserver\Place\File\Here\" $sessionOptions = New-Object WinSCP.SessionOptions -Property @{ Protocol = [WinSCP.Protocol]::Sftp HostName = $sftpServer UserName = $username SecurePassword = $securePassword SshHostKeyFingerprint = $fingerprint PortNumber = $port } $session = New-Object WinSCP.Session $session.SessionLogPath = $logpath $session.Open($sessionOptions) $session.GetFileToDirectory($remotePath, $localPath, $false, $null)
Is it just an issue with timeout? Or maybe the full version of my script somehow crashes the session? All it does is create 2 hashtables with remote/local files, compares them and then tries to download the missing files using the method above...Remote side sent disconnect message
type 11 (by application):
"FlowSshPacketDecoder: unresponsiveness timeout"
Can't get attributes of file '/Path/To/Remote/File.msi'.