SFTP Script - Upload Issue

Advertisement

Colby
Guest

SFTP Script - Upload Issue

I wrote this script to automate daily uploads to a SFTP server. I can not get the script to upload files > ~90+KB. There are 2–3 files total to upload daily but 1 of them is typically around 100KB. It only has to upload .txt files. I can upload as many small files (1-30KB) as I want but after that it gets weird and sometimes works or doesn't. In the log I realize it's throwing error 4 but before I started I made sure there was no duplicate file(s).
$localPath = "PATH"
$remotePath = "PATH"
 
Add-Type -Path "${env:ProgramFiles(x86)}\WINSCP\WINSCP .NET\WinSCPnet.dll"
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = ([WinSCP.Protocol]::Sftp)
    HostName = "..."
    UserName = "..."
    Password = "..."
    SshHostKeyFingerprint = "ssh-rsa ..."
}
 
$session = New-Object WinSCP.Session
$sessionOptions = New-Object WinSCP.SessionOptions
$session.Timeout = New-TimeSpan -Minutes 15
 
try {
    $session.SessionLogPath = "PATH"
    $session.Open($sessionOptions)
    if ($session.Opened) {
        Write-Host "Connected..."
    } else {
        Write-Host "Failed to connect..."
    }
    $fileTransfer = Get-ChildItem $localPath -File | Where-Object {$_.LastWriteTime -gt (Get-Date).Date -and $_.LastWriteTime -lt (Get-Date).AddDays(1).Date}
    Write-Host "Number of file(s) to upload: $($fileTransfer.Count)"
    foreach ($file in $fileTransfer) {Write-Host "Uploading file: $($file.FullName) to $($remotePath)"}
    Write-Host "-------------------------------------------------------------------------------------"
    foreach ($file in $fileTransfer) {
        $transferOptions = New-Object WinSCP.TransferOptions
        $transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
        $transferOptions.FileMask = ">=today"
        try {
            $transferResult = $session.PutFiles($file.FullName, $remotePath, $false, $transferOptions)
            $transferResult.Check()
            Write-Host "File $($file.Name) uploaded successfully."
        }
        catch {
            Write-Host "Error uploading $($file.Name): $($_.Exception.Message)"
        }
    }
} catch {
    exit 1
} finally {
    $session.Dispose()
    Write-Host "Disconnected..."
}

This is a log file of an unsuccessful upload
. 2023-05-05 09:19:01.732 --------------------------------------------------------------------------
. 2023-05-05 09:19:01.732 WinSCP Version 5.21.7 (Build 12963 2023-01-23) (OS 10.0.19045 - Windows 10 Enterprise)
. 2023-05-05 09:19:01.732 Configuration: nul
. 2023-05-05 09:19:01.732 Log level: Normal
. 2023-05-05 09:19:01.732 Local account: 
. 2023-05-05 09:19:01.732 Working directory: C:\Program Files (x86)\WINSCP\WINSCP .NET
. 2023-05-05 09:19:01.732 Process ID: 5944
. 2023-05-05 09:19:01.754 Ancestor processes: powershell, Code, Code, Code, explorer, ...
. 2023-05-05 09:19:01.754 Command-line: "C:\Program Files (x86)\WINSCP\WINSCP .NET\winscp.exe" /xmllog="PATH" /xmlgroups /xmllogrequired /nointeractiveinput /stdout /stdin /dotnet=5.21.7  /ini=nul /log="PATH"  /console /consoleinstance=_14584_54590918_13
. 2023-05-05 09:19:01.754 Time zone: Current: GMT-5, Standard: GMT-6 (Central Standard Time), DST: GMT-5 (Central Daylight Time)
. 2023-05-05 09:19:01.754 Login time: Friday, May 5, 2023 9:19:01 AM
. 2023-05-05 09:19:01.754 --------------------------------------------------------------------------
. 2023-05-05 09:19:01.754 Script: Retrospectively logging previous script records:
> 2023-05-05 09:19:01.754 Script: option batch on
< 2023-05-05 09:19:01.754 Script: batch           on        
< 2023-05-05 09:19:01.754 Script: reconnecttime   120       
> 2023-05-05 09:19:01.754 Script: option confirm off
< 2023-05-05 09:19:01.754 Script: confirm         off       
> 2023-05-05 09:19:01.754 Script: option reconnecttime 120
< 2023-05-05 09:19:01.754 Script: reconnecttime   120       
> 2023-05-05 09:19:01.754 Script: open sftp://... -hostkey="ssh-rsa ..." -timeout=15
. 2023-05-05 09:19:01.754 --------------------------------------------------------------------------
. 2023-05-05 09:19:01.754 Session name: ...
. 2023-05-05 09:19:01.754 Host name: ... (Port: 22)
. 2023-05-05 09:19:01.754 User name: ... (Password: Yes, Key file: No, Passphrase: No)
. 2023-05-05 09:19:01.754 Tunnel: No
. 2023-05-05 09:19:01.754 Transfer Protocol: SFTP
. 2023-05-05 09:19:01.754 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2023-05-05 09:19:01.754 Disable Nagle: No
. 2023-05-05 09:19:01.754 Proxy: None
. 2023-05-05 09:19:01.754 Send buffer: 262144
. 2023-05-05 09:19:01.754 Compression: No
. 2023-05-05 09:19:01.754 Bypass authentication: No
. 2023-05-05 09:19:01.754 Try agent: Yes; Agent forwarding: No; KI: Yes; GSSAPI: Yes
. 2023-05-05 09:19:01.754 GSSAPI: KEX: No; Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2023-05-05 09:19:01.754 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; No
. 2023-05-05 09:19:01.754 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2023-05-05 09:19:01.754 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2023-05-05 09:19:01.754 Simple channel: Yes
. 2023-05-05 09:19:01.754 Return code variable: Autodetect; Lookup user groups: Auto
. 2023-05-05 09:19:01.754 Shell: default
. 2023-05-05 09:19:01.754 EOL: LF, UTF: Auto
. 2023-05-05 09:19:01.754 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2023-05-05 09:19:01.754 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2023-05-05 09:19:01.754 SFTP Bugs: Auto,Auto
. 2023-05-05 09:19:01.754 SFTP Server: default
. 2023-05-05 09:19:01.754 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2023-05-05 09:19:01.754 Cache directory changes: Yes, Permanent: Yes
. 2023-05-05 09:19:01.754 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2023-05-05 09:19:01.754 DST mode: Unix
. 2023-05-05 09:19:01.754 --------------------------------------------------------------------------
< 2023-05-05 09:19:01.754 Script: Searching for host...
. 2023-05-05 09:19:01.755 Looking up host "..." for SSH connection
. 2023-05-05 09:19:01.759 Connecting to ... port 22
. 2023-05-05 09:19:01.793 Connected to ...
< 2023-05-05 09:19:01.793 Script: Connecting to host...
. 2023-05-05 09:19:01.793 We claim version: SSH-2.0-WinSCP_release_5.21.7
. 2023-05-05 09:19:01.793 Connected to ...
. 2023-05-05 09:19:01.826 Remote version: SSH-2.0-MOVEit Transfer SFTP
. 2023-05-05 09:19:01.826 Using SSH protocol version 2
. 2023-05-05 09:19:01.827 Have a known host key of type rsa2
. 2023-05-05 09:19:01.912 Doing ECDH key exchange with hash SHA-256
. 2023-05-05 09:19:02.054 Host key fingerprint is:
. 2023-05-05 09:19:02.054 ssh-rsa ...
< 2023-05-05 09:19:02.054 Script: Authenticating...
. 2023-05-05 09:19:02.054 Host key matches configured key fingerprint
. 2023-05-05 09:19:02.055 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] outbound encryption
. 2023-05-05 09:19:02.055 Initialised HMAC-SHA-256 outbound MAC algorithm
. 2023-05-05 09:19:02.081 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] inbound encryption
. 2023-05-05 09:19:02.081 Initialised HMAC-SHA-256 inbound MAC algorithm
! 2023-05-05 09:19:02.119 Using username "...".
< 2023-05-05 09:19:02.120 Script: Using username "...".
. 2023-05-05 09:19:02.153 Server offered these authentication methods: publickey,password
. 2023-05-05 09:19:02.153 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2023-05-05 09:19:02.153 Using stored password.
< 2023-05-05 09:19:02.153 Script: Authenticating with pre-entered password.
. 2023-05-05 09:19:02.153 Sent password
. 2023-05-05 09:19:02.632 Access granted
. 2023-05-05 09:19:02.632 Opening main session channel
. 2023-05-05 09:19:02.668 Opened main channel
. 2023-05-05 09:19:02.711 Started a shell/command
< 2023-05-05 09:19:02.711 Script: Authenticated.
. 2023-05-05 09:19:02.711 --------------------------------------------------------------------------
. 2023-05-05 09:19:02.711 Using SFTP protocol.
. 2023-05-05 09:19:02.711 Doing startup conversation with host.
< 2023-05-05 09:19:02.711 Script: Starting the session...
> 2023-05-05 09:19:02.712 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2023-05-05 09:19:02.742 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2023-05-05 09:19:02.742 SFTP version 3 negotiated.
. 2023-05-05 09:19:02.742 We believe the server has signed timestamps bug
. 2023-05-05 09:19:02.742 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2023-05-05 09:19:02.742 Getting current directory name.
. 2023-05-05 09:19:02.742 Getting real path for '.'
> 2023-05-05 09:19:02.742 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2023-05-05 09:19:02.818 Type: SSH_FXP_NAME, Size: 102, Number: 16
. 2023-05-05 09:19:02.818 Real path is '...'
. 2023-05-05 09:19:02.818 Startup conversation with host finished.
< 2023-05-05 09:19:02.818 Script: Session started.
< 2023-05-05 09:19:02.818 Script: Active session: [1] ...
> 2023-05-05 09:19:03.329 Script: pwd
< 2023-05-05 09:19:03.329 Script: PATH
> 2023-05-05 09:19:03.446 Script: put  -nopermissions -preservetime -transfer="binary" -filemask=">=today" -- "FILE" "PATH"
. 2023-05-05 09:19:03.454 Copying 1 files/directories to remote directory "PATH" - total size: 30,697
. 2023-05-05 09:19:03.454   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask: 
. 2023-05-05 09:19:03.454   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: >=today; ResumeL: 0
. 2023-05-05 09:19:03.454   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2023-05-05 09:19:03.454 File: 'FILE' [2023-05-05T13:41:23.501Z] [30697]
. 2023-05-05 09:19:03.455 Copying "FILE" to remote directory started.
. 2023-05-05 09:19:03.455 Binary transfer mode selected.
. 2023-05-05 09:19:03.455 Opening remote file.
> 2023-05-05 09:19:03.455 Type: SSH_FXP_OPEN, Size: 54, Number: 259
< 2023-05-05 09:19:03.544 Type: SSH_FXP_HANDLE, Size: 12, Number: 259
> 2023-05-05 09:19:03.544 Type: SSH_FXP_WRITE, Size: 30721, Number: 774
> 2023-05-05 09:19:03.545 Type: SSH_FXP_CLOSE, Size: 12, Number: 1028
> 2023-05-05 09:19:03.545 Type: SSH_FXP_SETSTAT, Size: 50, Number: 521
. 2023-05-05 09:19:19.750 Waiting for data timed out, asking user what to do.
. 2023-05-05 09:19:19.750 Asking user:
. 2023-05-05 09:19:19.750 **Host is not communicating for 15 seconds.
. 2023-05-05 09:19:19.750 
. 2023-05-05 09:19:19.750 Wait for another 15 seconds?** ()
< 2023-05-05 09:19:19.750 Script: Host is not communicating for more than 15 seconds.
< 2023-05-05 09:19:19.750 Still waiting...
< 2023-05-05 09:19:19.750 Note: If the problem repeats, try turning off 'Optimize connection buffer size'.
< 2023-05-05 09:19:19.750 Warning: Aborting this operation will close connection!
. 2023-05-05 09:19:22.811 Data has arrived, closing query to user.
. 2023-05-05 09:19:22.811 Answer: OK
. 2023-05-05 09:19:22.811 Network error: Software caused connection abort
. 2023-05-05 09:19:22.812 Connection was lost, asking what to do.
. 2023-05-05 09:19:22.812 Asking user:
. 2023-05-05 09:19:22.812 Network error: Software caused connection abort ()
< 2023-05-05 09:19:22.812 Script: Network error: Software caused connection abort
. 2023-05-05 09:19:27.813 Answer: Retry
< 2023-05-05 09:19:27.814 Script: Searching for host...
. 2023-05-05 09:19:27.815 Looking up host "..." for SSH connection
. 2023-05-05 09:19:27.871 Connecting to ... port 22
. 2023-05-05 09:19:27.903 Connected to ...
< 2023-05-05 09:19:27.903 Script: Connecting to host...
. 2023-05-05 09:19:27.904 We claim version: SSH-2.0-WinSCP_release_5.21.7
. 2023-05-05 09:19:27.904 Connected to ...
. 2023-05-05 09:19:27.930 Remote version: SSH-2.0-MOVEit Transfer SFTP
. 2023-05-05 09:19:27.930 Using SSH protocol version 2
. 2023-05-05 09:19:27.930 Have a known host key of type rsa2
. 2023-05-05 09:19:28.009 Doing ECDH key exchange with hash SHA-256
. 2023-05-05 09:19:28.159 Host key fingerprint is:
. 2023-05-05 09:19:28.159 ssh-rsa ...
< 2023-05-05 09:19:28.160 Script: Authenticating...
. 2023-05-05 09:19:28.160 Host key matches configured key fingerprint
. 2023-05-05 09:19:28.160 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] outbound encryption
. 2023-05-05 09:19:28.160 Initialised HMAC-SHA-256 outbound MAC algorithm
. 2023-05-05 09:19:28.180 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] inbound encryption
. 2023-05-05 09:19:28.180 Initialised HMAC-SHA-256 inbound MAC algorithm
! 2023-05-05 09:19:28.225 Using username "...".
< 2023-05-05 09:19:28.225 Script: Using username "...".
. 2023-05-05 09:19:28.257 Server offered these authentication methods: publickey,password
. 2023-05-05 09:19:28.257 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2023-05-05 09:19:28.257 Using stored password.
< 2023-05-05 09:19:28.257 Script: Authenticating with pre-entered password.
. 2023-05-05 09:19:28.258 Sent password
. 2023-05-05 09:19:28.698 Access granted
. 2023-05-05 09:19:28.698 Opening main session channel
. 2023-05-05 09:19:28.731 Opened main channel
. 2023-05-05 09:19:28.763 Started a shell/command
< 2023-05-05 09:19:28.763 Script: Authenticated.
. 2023-05-05 09:19:28.763 Doing startup conversation with host.
< 2023-05-05 09:19:28.763 Script: Starting the session...
> 2023-05-05 09:19:28.764 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2023-05-05 09:19:28.796 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2023-05-05 09:19:28.796 SFTP version 3 negotiated.
. 2023-05-05 09:19:28.796 We believe the server has signed timestamps bug
. 2023-05-05 09:19:28.796 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2023-05-05 09:19:28.796 Changing directory to "PATH".
. 2023-05-05 09:19:28.796 Getting real path for 'PATH'
> 2023-05-05 09:19:28.796 Type: SSH_FXP_REALPATH, Size: 20, Number: 1296
< 2023-05-05 09:19:28.897 Type: SSH_FXP_NAME, Size: 102, Number: 1296
. 2023-05-05 09:19:28.897 Real path is 'PATH'
. 2023-05-05 09:19:28.897 Trying to open directory "PATH".
> 2023-05-05 09:19:28.897 Type: SSH_FXP_LSTAT, Size: 20, Number: 1543
< 2023-05-05 09:19:28.932 Type: SSH_FXP_ATTRS, Size: 37, Number: 1543
. 2023-05-05 09:19:28.932 Getting current directory name.
. 2023-05-05 09:19:28.932 Startup conversation with host finished.
< 2023-05-05 09:19:28.932 Script: Session started.
. 2023-05-05 09:19:28.933 File: '...' [2023-05-05T13:41:23.501Z] [30697]
. 2023-05-05 09:19:28.934 Copying "..." to remote directory started.
. 2023-05-05 09:19:28.934 Binary transfer mode selected.
. 2023-05-05 09:19:28.934 Opening remote file.
> 2023-05-05 09:19:28.934 Type: SSH_FXP_OPEN, Size: 54, Number: 1795
< 2023-05-05 09:19:29.021 Type: SSH_FXP_STATUS, Size: 30, Number: 1795
< 2023-05-05 09:19:29.021 Status code: 4, Message: 1795, Server: Server error., Language:  
> 2023-05-05 09:19:29.021 Type: SSH_FXP_LSTAT, Size: 38, Number: 2055
< 2023-05-05 09:19:29.071 Type: SSH_FXP_ATTRS, Size: 37, Number: 2055
* 2023-05-05 09:19:29.071 (ETerminal) General failure (server should provide error description).
* 2023-05-05 09:19:29.071 Error code: 4
* 2023-05-05 09:19:29.071 Error message from server: Server error.
* 2023-05-05 09:19:29.071 
* 2023-05-05 09:19:29.071 Common reasons for the Error code 4 are:
* 2023-05-05 09:19:29.071 - Renaming a file to a name of already existing file.
* 2023-05-05 09:19:29.071 - Creating a directory that already exists.
* 2023-05-05 09:19:29.071 - Moving a remote file to a different filesystem (HDD).
* 2023-05-05 09:19:29.071 - Uploading a file to a full filesystem (HDD).
* 2023-05-05 09:19:29.071 - Exceeding a user disk quota.
. 2023-05-05 09:19:29.071 Asking user:
. 2023-05-05 09:19:29.071 Cannot overwrite remote file 'FILE'.$$
. 2023-05-05 09:19:29.071  
. 2023-05-05 09:19:29.071 Press 'Delete' to delete the file and create new one instead of overwriting it.$$ ("General failure (server should provide error description).
. 2023-05-05 09:19:29.071 Error code: 4
. 2023-05-05 09:19:29.071 Error message from server: Server error.
. 2023-05-05 09:19:29.071 
. 2023-05-05 09:19:29.071 Common reasons for the Error code 4 are:
. 2023-05-05 09:19:29.071 - Renaming a file to a name of already existing file.
. 2023-05-05 09:19:29.071 - Creating a directory that already exists.
. 2023-05-05 09:19:29.071 - Moving a remote file to a different filesystem (HDD).
. 2023-05-05 09:19:29.071 - Uploading a file to a full filesystem (HDD).
. 2023-05-05 09:19:29.071 - Exceeding a user disk quota.")
< 2023-05-05 09:19:29.071 Script: Cannot overwrite remote file 'FILE'.
< 2023-05-05 09:19:29.071 Script: General failure (server should provide error description).
< 2023-05-05 09:19:29.071 Error code: 4
< 2023-05-05 09:19:29.071 Error message from server: Server error.
< 2023-05-05 09:19:29.071 Common reasons for the Error code 4 are:
< 2023-05-05 09:19:29.071 - Renaming a file to a name of already existing file.
< 2023-05-05 09:19:29.071 - Creating a directory that already exists.
< 2023-05-05 09:19:29.071 - Moving a remote file to a different filesystem (HDD).
< 2023-05-05 09:19:29.071 - Uploading a file to a full filesystem (HDD).
< 2023-05-05 09:19:29.071 - Exceeding a user disk quota.
. 2023-05-05 09:19:29.072 Answer: Abort
* 2023-05-05 09:19:29.072 (ESkipFile) Cannot overwrite remote file 'FILE'.$$
* 2023-05-05 09:19:29.072  
* 2023-05-05 09:19:29.072 Press 'Delete' to delete the file and create new one instead of overwriting it.$$
* 2023-05-05 09:19:29.072 General failure (server should provide error description).
* 2023-05-05 09:19:29.072 Error code: 4
* 2023-05-05 09:19:29.072 Error message from server: Server error.
* 2023-05-05 09:19:29.072 
* 2023-05-05 09:19:29.072 Common reasons for the Error code 4 are:
* 2023-05-05 09:19:29.072 - Renaming a file to a name of already existing file.
* 2023-05-05 09:19:29.072 - Creating a directory that already exists.
* 2023-05-05 09:19:29.072 - Moving a remote file to a different filesystem (HDD).
* 2023-05-05 09:19:29.072 - Uploading a file to a full filesystem (HDD).
* 2023-05-05 09:19:29.072 - Exceeding a user disk quota.
. 2023-05-05 09:19:29.072 Copying finished: Transferred: 0, Elapsed: 0:00:25, CPS: 0/s
. 2023-05-05 09:19:29.072 Script: Failed
> 2023-05-05 09:19:29.648 Script: put  -nopermissions -preservetime -transfer="binary" -filemask=">=today" -- "FILE" "PATH"
. 2023-05-05 09:19:29.650 Copying 1 files/directories to remote directory "PATH" - total size: 46,522
. 2023-05-05 09:19:29.650   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask: 
. 2023-05-05 09:19:29.650   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: >=today; ResumeL: 0
. 2023-05-05 09:19:29.650   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2023-05-05 09:19:29.650 File: 'FILE' [2023-05-05T14:04:54.790Z] [46522]
. 2023-05-05 09:19:29.650 Copying "FILE" to remote directory started.
. 2023-05-05 09:19:29.650 Binary transfer mode selected.
. 2023-05-05 09:19:29.650 Opening remote file.
> 2023-05-05 09:19:29.650 Type: SSH_FXP_OPEN, Size: 57, Number: 2307
< 2023-05-05 09:19:29.747 Type: SSH_FXP_HANDLE, Size: 12, Number: 2307
> 2023-05-05 09:19:29.747 Type: SSH_FXP_WRITE, Size: 32792, Number: 2822
. 2023-05-05 09:19:29.747 1 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2023-05-05 09:19:29.747 Type: SSH_FXP_CLOSE, Size: 12, Number: 3332
> 2023-05-05 09:19:29.748 Type: SSH_FXP_SETSTAT, Size: 53, Number: 2569
. 2023-05-05 09:19:46.034 Waiting for data timed out, asking user what to do.
. 2023-05-05 09:19:46.034 Asking user:
. 2023-05-05 09:19:46.034 **Host is not communicating for 15 seconds.
. 2023-05-05 09:19:46.034 
. 2023-05-05 09:19:46.034 Wait for another 15 seconds?** ()
< 2023-05-05 09:19:46.034 Script: Host is not communicating for more than 15 seconds.
< 2023-05-05 09:19:46.034 Still waiting...
< 2023-05-05 09:19:46.034 Note: If the problem repeats, try turning off 'Optimize connection buffer size'.
< 2023-05-05 09:19:46.034 Warning: Aborting this operation will close connection!
. 2023-05-05 09:19:49.126 Data has arrived, closing query to user.
. 2023-05-05 09:19:49.126 Answer: OK
. 2023-05-05 09:19:49.126 Network error: Software caused connection abort
. 2023-05-05 09:19:49.127 Connection was lost, asking what to do.
. 2023-05-05 09:19:49.127 Asking user:
. 2023-05-05 09:19:49.127 Network error: Software caused connection abort ()
< 2023-05-05 09:19:49.127 Script: Network error: Software caused connection abort
. 2023-05-05 09:19:54.141 Answer: Retry
< 2023-05-05 09:19:54.141 Script: Searching for host...
. 2023-05-05 09:19:54.142 Looking up host "fbitn.moveitcloud.com" for SSH connection
. 2023-05-05 09:19:54.142 Connecting to ... port 22
. 2023-05-05 09:19:54.175 Connected to ...
< 2023-05-05 09:19:54.175 Script: Connecting to host...
. 2023-05-05 09:19:54.175 We claim version: SSH-2.0-WinSCP_release_5.21.7
. 2023-05-05 09:19:54.175 Connected to ...
. 2023-05-05 09:19:54.207 Remote version: SSH-2.0-MOVEit Transfer SFTP
. 2023-05-05 09:19:54.207 Using SSH protocol version 2
. 2023-05-05 09:19:54.208 Have a known host key of type rsa2
. 2023-05-05 09:19:54.278 Doing ECDH key exchange with hash SHA-256
. 2023-05-05 09:19:54.377 Host key fingerprint is:
. 2023-05-05 09:19:54.377 ssh-rsa ...
< 2023-05-05 09:19:54.377 Script: Authenticating...
. 2023-05-05 09:19:54.377 Host key matches configured key fingerprint
. 2023-05-05 09:19:54.377 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] outbound encryption
. 2023-05-05 09:19:54.377 Initialised HMAC-SHA-256 outbound MAC algorithm
. 2023-05-05 09:19:54.417 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] inbound encryption
. 2023-05-05 09:19:54.417 Initialised HMAC-SHA-256 inbound MAC algorithm
! 2023-05-05 09:19:54.449 Using username "...".
< 2023-05-05 09:19:54.449 Script: Using username "...".
. 2023-05-05 09:19:54.482 Server offered these authentication methods: publickey,password
. 2023-05-05 09:19:54.482 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2023-05-05 09:19:54.482 Using stored password.
< 2023-05-05 09:19:54.482 Script: Authenticating with pre-entered password.
. 2023-05-05 09:19:54.482 Sent password
. 2023-05-05 09:19:54.978 Access granted
. 2023-05-05 09:19:54.978 Opening main session channel
. 2023-05-05 09:19:55.012 Opened main channel
. 2023-05-05 09:19:55.040 Started a shell/command
< 2023-05-05 09:19:55.040 Script: Authenticated.
. 2023-05-05 09:19:55.044 Doing startup conversation with host.
< 2023-05-05 09:19:55.044 Script: Starting the session...
> 2023-05-05 09:19:55.044 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2023-05-05 09:19:55.077 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2023-05-05 09:19:55.077 SFTP version 3 negotiated.
. 2023-05-05 09:19:55.077 We believe the server has signed timestamps bug
. 2023-05-05 09:19:55.077 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2023-05-05 09:19:55.077 Changing directory to "PATH".
. 2023-05-05 09:19:55.077 Getting real path for 'PATH'
> 2023-05-05 09:19:55.077 Type: SSH_FXP_REALPATH, Size: 20, Number: 3600
< 2023-05-05 09:19:55.180 Type: SSH_FXP_NAME, Size: 102, Number: 3600
. 2023-05-05 09:19:55.180 Real path is 'PATH'
. 2023-05-05 09:19:55.180 Trying to open directory "PATH".
> 2023-05-05 09:19:55.180 Type: SSH_FXP_LSTAT, Size: 20, Number: 3847
< 2023-05-05 09:19:55.251 Type: SSH_FXP_ATTRS, Size: 37, Number: 3847
. 2023-05-05 09:19:55.251 Getting current directory name.
. 2023-05-05 09:19:55.251 Startup conversation with host finished.
< 2023-05-05 09:19:55.251 Script: Session started.
. 2023-05-05 09:19:55.251 File: 'FILE' [2023-05-05T14:04:54.790Z] [46522]
. 2023-05-05 09:19:55.252 Copying "FILE" to remote directory started.
. 2023-05-05 09:19:55.252 Binary transfer mode selected.
. 2023-05-05 09:19:55.252 Opening remote file.
> 2023-05-05 09:19:55.252 Type: SSH_FXP_OPEN, Size: 57, Number: 4099
< 2023-05-05 09:19:55.360 Type: SSH_FXP_HANDLE, Size: 12, Number: 4099
> 2023-05-05 09:19:55.360 Type: SSH_FXP_WRITE, Size: 32792, Number: 4614
. 2023-05-05 09:19:55.361 1 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2023-05-05 09:19:55.361 Type: SSH_FXP_CLOSE, Size: 12, Number: 5124
> 2023-05-05 09:19:55.361 Type: SSH_FXP_SETSTAT, Size: 53, Number: 4361
. 2023-05-05 09:20:11.580 Waiting for data timed out, asking user what to do.
. 2023-05-05 09:20:11.580 Asking user:
. 2023-05-05 09:20:11.580 **Host is not communicating for 15 seconds.
Then it basically loops until I force close it

This is a PowerShell terminal output.
PowerShell Extension v2023.5.0      
Copyright (c) Microsoft Corporation.

https://aka.ms/vscode-powershell    
Type 'help' to get help.

PS C:\Users\*\Desktop\Scripts> 
PS C:\Users\*\Desktop\Scripts> . 'PATH.ps1'
Connected...
Number of file(s) to upload: 4
Uploading file: FILE.txt to REMOTE DIR   
Uploading file: FILE.txt to REMOTE DIR
Uploading file: FILE.txt to REMOTE DIR       
Uploading file: FILE.txt to REMOTE DIR
-------------------------------------------------------------------------------------
Error uploading FILE.txt: Exception calling "Check" with "0" argument(s): "Cannot overwrite remote file 'PATH/FILE'.$$

Press 'Delete' to delete the file and create new one instead of overwriting it.$$
General failure (server should provide error description).
Error code: 4
Error message from server: Server error.

Common reasons for the Error code 4 are:
- Renaming a file to a name of already existing file.
- Creating a directory that already exists.
- Moving a remote file to a different filesystem (HDD).
- Uploading a file to a full filesystem (HDD).
- Exceeding a user disk quota."

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum