Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

martin

Re: Download content not same as source file

As Add-Type is not within try .. catch your log file won't contain its errors.

Make sure you redirect an output of PowerShell to another log file to see error that the Add-Type most probably issues.

Note that you path still refers to winscp576automation, while you claim to have upgraded to 5.9.6.
weh

Download content not same as source file

Windows task scheduler has been setup to invoke the powershell script which similar to https://winscp.net/eng/docs/library_session_synchronizedirectories. Attached is the script which server name and authentication has been remove

For the new version, after unzip the file, I copy over all the files for the new version and replace the existing files in the folder D:\Program Files (x86)\winscp576automation that powershell script refer.

Only below lines can be found in the log file
[07/25/2017 17:36:33] Sync Started
[07/25/2017 17:36:33] Cannot find type [WinSCP.SessionOptions]: verify that the assembly containing this type is loaded.
[07/25/2017 17:36:33] Sync Stopped

Just thought of may be the new version will have resolve the content download issue, so would like to upgrade, monitor and verify
martin

Sorry, I've forgot that you are using the assembly.

weh wrote:

When upgrade to version 5.9.6, it will return below error
"Cannot find type [WinSCP.SessionOptions]: verify that the assembly containing this type is loaded."

I do not see, how an upgrade could have caused this. To help you, we need to know more about your script. How do you load the assembly? Is this really the first error, that your script issues? Isn't there some error earlier, when attempting to load the assembly? Where do you have the assembly stored?
weh

Currently when run the powershell script $session.DebugLogLevel = 2 to turn on debug level 2 in version 5.7.6, it will return below error
"Specified argument was out of the range of valid values.
Parameter name: Logging level has to be in range 0-1"

When upgrade to version 5.9.6, it will return below error
"Cannot find type [WinSCP.SessionOptions]: verify that the assembly containing this type is loaded."
weh

Download content not same as source file

That is SFTP server provide by client. It not happen all the time, only when connection issue happen during the download which show in the log. How to turn on level Debug 2?

. 2017-07-15 14:00:42.501 Waiting for data timed out, asking user what to do.
. 2017-07-15 14:00:42.501 Asking user:
. 2017-07-15 14:00:42.501 **Host is not communicating for 15 seconds.
. 2017-07-15 14:00:42.501
. 2017-07-15 14:00:42.501 Wait for another 15 seconds?** ()
< 2017-07-15 14:00:42.501 Script: Host is not communicating for more than 15 seconds.
< 2017-07-15 14:00:42.501 Still waiting...
< 2017-07-15 14:00:42.501 Note: If the problem repeats, try turning off 'Optimize connection buffer size'.
< 2017-07-15 14:00:42.501 Warning: Aborting this operation will close connection!
. 2017-07-15 14:01:43.847 Attempt to close connection due to fatal exception:
* 2017-07-15 14:01:43.847 **Terminated by user.**
. 2017-07-15 14:01:43.847 Closing connection.
. 2017-07-15 14:01:43.847 Sending special code: 12
. 2017-07-15 14:01:43.847 Sent EOF message
. 2017-07-15 14:01:43.847 Connection was lost, asking what to do.
. 2017-07-15 14:01:43.847 Asking user:
. 2017-07-15 14:01:43.847 Terminated by user. ()
< 2017-07-15 14:01:43.847 Script: Terminated by user.
< 2017-07-15 14:01:48.925 Script: Searching for host...
martin

Re: Download content not same as source file

Thanks for the log.

I do not see anything wrong on WinSCP side. What SFTP server is that? It pretends to be OpenSSH, but clearly it's not. At least not any official OpenSSH build.

Are you able to reproduce the problem? If you are, can you send us log file on level Debug 2?
weh

Re: Download content not same as source file

martin wrote:

What protocol are you using? Do you have any log file showing what did really happen?


I am using SFTP with private key. File attached
martin

Re: Download content not same as source file

What protocol are you using? Do you have any log file showing what did really happen?
weh

Download content not same as source file

The powershell script in https://winscp.net/eng/docs/library_session_synchronizedirectories have been used to synchronize the files in destination folder with the remote location. Recently there are few cases which the content in destination folder does not match with remote location. Example the source file in remote location has 20 lines but the file in destination location content the first 10 lines twice and the remaining 10 lines at the end of the source file were missing in the destination file. Just suspect it might due to connection disconnect before download complete and issue occur when connection resume. How to change the script so that the files in destination location will be overwrite when connection issue happen instead of resume using powershell script? Or any other suggestion on how to fix this issue?