Unable to transfer large files - Network error: Software caused connection abort
Hi,
I am trying to automate the upload of few files nightly using the .NET Assembly and it's working for most of my files except 1 file, the file is ~5GB in size.
When I run the PS script interactively from PS ISE it work 100% all the time, but when the task run from Task Scheduler (under my user account) it fails for that specific file.
I am sure this is environmental issue and it's related to some settings but I am unable to figure out which setting I am missing.
I am attaching the debug log and the regular log for two different sessions.
here is my session setting in PS:
I am trying to automate the upload of few files nightly using the .NET Assembly and it's working for most of my files except 1 file, the file is ~5GB in size.
When I run the PS script interactively from PS ISE it work 100% all the time, but when the task run from Task Scheduler (under my user account) it fails for that specific file.
I am sure this is environmental issue and it's related to some settings but I am unable to figure out which setting I am missing.
I am attaching the debug log and the regular log for two different sessions.
here is my session setting in PS:
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{ Protocol = [WinSCP.Protocol]::Sftp HostName = "10.XXX.XXX.XXX" UserName = "XXX" PrivateKeyPassphrase = 'xxx' SshPrivateKeyPath = "C:\Program Files\WinSCP-Portable\WinSCP_Auth\XYZ.ppk" SshHostKeyFingerprint = "ssh-rsa 2048 XXXXXXXXXXXXXX=" } $sessionOptions.AddRawSettings("SendBuf", "0") $sessionOptions.AddRawSettings("SshSimple", "1") $session = New-Object WinSCP.Session $transferOptions = New-Object WinSCP.TransferOptions $transferOptions.TransferMode = [WinSCP.TransferMode]::Binary $transferOptions.PreserveTimestamp = $false Function Connect-To-SFTP { # Check if session is already in progress If ($session.Opened) { Write-Host "SFTP session is already open.. proceed" return $true } # Setup session options $session.SessionLogPath = $LogFile $session.DebugLogPath = $DebugFile try { # Try Connecting to the SFTP Write-host "Connecting to the SFTP server" $session.Open($sessionOptions) write-host "Connected, Switching to binary transfer" $transferOptions = New-Object WinSCP.TransferOptions $transferOptions.TransferMode = [WinSCP.TransferMode]::Binary return $true } catch { Write-Host "Error: $($_.Exception.Message)" return $false } }