Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

chris.milne@live.com.au

Solved

Hi Martin, Thanks for that! The generator showed the error in my code path – it was around a try/catch sequencing issue.
martin

Re: Logs

@chris.milne: In the GUI, you are using FTP protocol, while in the script you are trying to use S3. Why?
If you want to use the same connection as in the GUI, the easiest way is to have the GUI generate a code template for you:
https://winscp.net/eng/docs/ui_generateurl#code
chris.milne@live.com.au

Logs

Please find attached the logs
martin

Re: Having the same issue - any hints on the firewall solution?

@chris.milne: Please, start by posting logs from both scenarios.
chris.milne@live.com.au

Having the same issue - any hints on the firewall solution?

Hi, we are encountering the same issue with the GUI working, but not a PowerShell script. Have tried the suggestions in this article, however no luck.

Could you shed some light on what the firewall issue was?
martin

Re: Issue solved

Thanks for sharing your resolution.
sparkei

Issue solved

Firewall issue which was somehow ok via GUI.
sparkei

Hi:
This has no affect. What now happens is the PowerShell script just hangs for slightly longer before failing and will still result in a 0kb file on the FTP server
Exception calling "PutFiles" with "4" argument(s): "Timeout waiting for WinSCP to respond"

At C:\temp\Folder\WinSCP-5.19.6-Automation\autoscript.ps1:40 char:5
+     $session.PutFiles("C:\temp\Folder\testusers_202202141 ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : TimeoutException
martin

Re: Attached logs (2)

In WinSCP GUI, you have turned off Automatic Resume / Transfer to Temporary Filename.
https://winscp.net/eng/docs/resume
https://winscp.net/eng/docs/ui_pref_resume
The script uses the default configuration, where this is turned on. While it should not be a problem in general, as you are using rare SFTP server, it might have a bug that causes troubles. Don't you have the option turned off in the GUI for this very reason? Won't turning it off in the script help?
Try adding -resumesupport=off to the put command:
https://winscp.net/eng/docs/scriptcommand_put#resumesupport
sparkei

Attached logs (2)

Attached logs.
I have $sessionOptions.AddRawSettings("SendBuf", "0") in the script ok on $session.Open($sessionOptions) so it doesn't solve the issue.
sparkei

Logging attached

Logging files attached
martin

Re: AWS server can transfer via GUI but not via scripting

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.


An equivalent log from GUI showing a successful upload of the same set of files would be useful too.
sparkei1

AWS server can transfer via GUI but not via scripting

Hi
Version of WinSCP 5.19.6- using version downloaded for automation.
Issue
We are trying to automate to an Amazon AWS transfer family server to send a small csv of hundreds of kb. What happens though is via any scripting or automation the server will only accept one line of csv data. Any more and the server we are sending to times out does not respond and using different software and wireshark found it would fail for 19 seconds with the server not responding. When trying to send via the GUI this issue does not persist which is what is difficult to understand.
We have limited availability to get server side to see why it does not respond. The root directory is "/" where we save to with the AWS url, I saw some notes around this in FAQs but can get files list ok from this directory so not sure where to go around this.
Is there anyone with further WinSCP automation able to advise any ideas of what I can do to get the file to put successfully using a script in this situation/ or point out what config settings on AWS side should be looked into

I have attached an example script. N.B. I was starting to list files in a local directory but it only
Exception calling "PutFiles" with "4" argument(s): "Timeout waiting for WinSCP to respond"

At \WinSCP-5.19.6-Automation\autoscript.ps1:34 char:5
+     $session.PutFiles("dir\test.csv
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : TimeoutException