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

martin

Re: Enumeration of VBS

msdev7807 wrote:

How would I known to use 2 for the transfer resume property, transferOptions.ResumeSupport.State = TransferResumeSupportState_Off

Noone wants you to use 2, use the TransferResumeSupportState_Off.

Where are all these enumerations defined in the documentation?

https://winscp.net/eng/docs/library_transferresumesupport#state
msdev7807

Enumeration of VBS

Thank you Martin,


I will try embedding the VBS into a WSF and running it that way. I assume you have to add the following to run as CScript myscript.wsf
<job>
<reference object="WinSCP.Session" />
<script language="VBScript">

CODE HERE

</script>
</job>

I have the same issue with trying to set Ignore Permission Errors (currently in another post).

I still feel there is a lot of functionality that is missing from the documentation. Perhaps there needs to be an effort to add more examples to the documentation. Or maybe I am not looking in the right place?? How would I known to use 2 for the transfer resume property, transferOptions.ResumeSupport.State = TransferResumeSupportState_Off Where are all these enumerations defined in the documentation? TransferResumeSupportState_Off is equivalent to TransferResume.SupportState.Off as stated in the documentation. This is where I think it is unclear. Doesn't mean we can't add clarification.



Thanks!
martin

Re: Transfer / Resume FilePart

msdev7807 wrote:

I sure wish this was documented somewhere indicating what specific properties don't work in VBS.

Every VBScript/JScript example on this sites starts with:
In this example the VBScript script is embedded into WSF file, to allow access to enumeration values.


And that you have to hard code them!

No you do not have to, as explained in the link.
msdev7807

Re: Transfer / Resume FilePart

martin wrote:

Actually, how do you run the script? Is it plain .vbs? Or is it .wsf as shown here?
https://winscp.net/eng/docs/library_com_wsh#enums
The TransferResumeSupportState_Off cannot work in plain .vbs. In plain .vbs, you can use 2.

Actually neither Protocol_Sftp nor TransferMode_Binary work in .vbs. But as .vbs turns all undefined symbols to 0, what is coincidentally also the value of Protocol_Sftp and TransferMode_Binary, it just happens to work in the end.


Martin,

That worked! I am seeing the " -resumesupport="off" in the session log. Haven't received confirmation from the FTP site owner yet, but I anticipate it will be OK. I sure wish this was documented somewhere indicating what specific properties don't work in VBS. And that you have to hard code them! There needs to be a dictionary / index of all these properties and what value maps to what. It would have saved a lot of time :) :D :) The examples are helpful, but in this case this really wasn't addressed in the VBS scripting examples. I use WScript.exe and then the name of the script to execute the script. Everything else has worked fine.


Thank you again for your persistence in solving this issue. Very much appreciated!
martin

Re: Transfer / Resume FilePart

Actually, how do you run the script? Is it plain .vbs? Or is it .wsf as shown here?
https://winscp.net/eng/docs/library_com_wsh#enums
The TransferResumeSupportState_Off cannot work in plain .vbs. In plain .vbs, you can use 2.

Actually neither Protocol_Sftp nor TransferMode_Binary work in .vbs. But as .vbs turns all undefined symbols to 0, what is coincidentally also the value of Protocol_Sftp and TransferMode_Binary, it just happens to work in the end.
msdev7807

Re: Transfer / Resume FilePart

martin wrote:

So can you change something that will break the script, like password, username or file path and check if it gets reflected in the log?


I pass in a bogus password and in the log it produced:

. 2017-10-27 15:17:31.404 Disconnected: Unable to authenticate

So this is the correct log.

On the put entry in the log indicates:

Script: put -nopermissions -preservetime -transfer="binary"

The only property I am setting in the code is -transfer="binary" And the Transfer Resume below:

transferOptions.ResumeSupport.State = TransferResumeSupportState_Off
transferOptions.TransferMode = TransferMode_Binary


I am not setting -nopermissions -preservetime at all in the script code.

I really need to get this working. If you can post some sample code that works, that would be awesome. Remember the FTP site you are uploading must have security of Execute and Write.... No Read.
martin

Re: Transfer / Resume FilePart

So can you change something that will break the script, like password, username or file path and check if it gets reflected in the log?
msdev7807

Transfer / Resume FilePart

Here is the log. I remarked out the
transferOptions.PreserveTimestamp = False ( doesn't match what is in the log -preservetime).)

In the log, I still see no -resumesupport="off":

Script: put -nopermissions -preservetime -transfer="binary"

If you notice, there is no actual "= setting" (on or off) for -nopermissions -preservetime As opposed to transfer where it has = "binary"
Neither of these are being set anywhere in the VB Script.

Please keep me posted.


Thanks again Martin.
msdev7807

Transfer Resume

Thanks again Martin,

I checked the value of transferOptions.ResumeSupport.State It returned 0.

Wscript.Echo transferOptions.ResumeSupport.State

I have already removed the PreserveTimeStamp code.

I should have the log for you soon.
martin

Re: Transfer Resume Options

I have no idea.
Can you make some change in the code, like removing the transferOptions.PreserveTimestamp = False and check, if the change reflects in the log? Post the log again.
msdev7807

Transfer Resume Options

Hello Martin,

Sorry for the delay in getting back to you.

This was the correct log file, all the files that transferred during the script had the correct filenames, etc. The log gets created within the script via the session.SessionLogPath = "C:\Scripts\Logs\LogName.txt", I pass the process name, "Session" key word, and a date time stamp. I had to de- identify certain portions of the log for security reasons. And you are right it is not setting that option -resumesupport="off". That is what the problem is... Any ideas how to correct this?

Just wanted to confirm the version. I am using version Version 5.9.4 (Build 7333) I am hoping it isn't an issue with this version / build.

Just to reiterate: The FTP site has only granted Execute and Write permissions only, no Read..

Thanks again for your help. Sorry for the delay.
martin

Re: Transfer resume issues still not working

When I run your code, it behaves as expected:
> 2017-10-19 12:13:19.065 Script: put -nopermissions -nopreservetime -transfer="binary" -resumesupport="off" -- "c:\source\file.csv" "/dest/"
While in your log, I do not see the -resumesupport="off":
> 2017-10-16 07:00:08.583 Script: put -nopermissions -nopreservetime -transfer="binary" -- "\\Folder\file.csv" "/Folder/"
It looks like the log file was not produced by the code you have posted. Make sure you are running the right version of the code.
msdev7807

Re: Transfer resume issues still not working

martin wrote:

Show us your complete current code and complete session log file.


Thanks Martin,

See attached (Private) Code Example and de-identified (security etc)log. I did not see the entry: Checking existence of partially transfered file. in the log.

I hope there is a solution.

Thanks!
martin

Re: Transfer resume issues still not working

Show us your complete current code and complete session log file.
msdev7807

Transfer resume issues still not working

Martin,
just got confirmation that the .Filepart files are still being created. So the above transfer resume property settings did not resolve the issue.

Any ideas?

Works fine through the client with transfer resume disabled. Just wondering what how I can disable this via scripting.

Thanks
msdev7807

Transfer options

Martin,
I set the property as specified: But in the detail log what is highlighted below mean? Does this mean transfer resume is still enabled? I am still waiting on the confirmation..

. 2017-10-10 07:00:06.161 Binary transfer mode selected.
. 2017-10-10 07:00:06.161 Checking existence of file.
> 2017-10-10 07:00:06.161 Type: SSH_FXP_LSTAT, Size: 50, Number: 2823
< 2017-10-10 07:00:06.194 Type: SSH_FXP_STATUS, Size: 83, Number: 2823
< 2017-10-10 07:00:06.194 Status code: 2
. 2017-10-10 07:00:06.194 Checking existence of partially transfered file.
> 2017-10-10 07:00:06.194 Type: SSH_FXP_LSTAT, Size: 59, Number: 3079
< 2017-10-10 07:00:06.216 Type: SSH_FXP_STATUS, Size: 92, Number: 3079
< 2017-10-10 07:00:06.216 Status code: 2
. 2017-10-10 07:00:06.216 Opening remote file.
> 2017-10-10 07:00:06.216 Type: SSH_FXP_OPEN, Size: 75, Number: 3331
< 2017-10-10 07:00:06.325 Type: SSH_FXP_HANDLE, Size: 11, Number: 3331
> 2017-10-10 07:00:06.325 Type: SSH_FXP_WRITE, Size: 32791, Number: 3846
. 2017-10-10 07:00:10.375 563 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2017-10-10 07:00:10.375 Type: SSH_FXP_CLOSE, Size: 11, Number: 77316
< 2017-10-10 07:00:10.375 Type: SSH_FXP_STATUS, Size: 49, Number: 74758
< 2017-10-10 07:00:10.390 Type: SSH_FXP_STATUS, Size: 49, Number: 75014
< 2017-10-10 07:00:10.406 Type: SSH_FXP_STATUS, Size: 49, Number: 75270
< 2017-10-10 07:00:10.421 Type: SSH_FXP_STATUS, Size: 49, Number: 75526
< 2017-10-10 07:00:10.437 Type: SSH_FXP_STATUS, Size: 49, Number: 75782
< 2017-10-10 07:00:10.453 Type: SSH_FXP_STATUS, Size: 49, Number: 76038
< 2017-10-10 07:00:10.453 Type: SSH_FXP_STATUS, Size: 49, Number: 76294
< 2017-10-10 07:00:10.484 Type: SSH_FXP_STATUS, Size: 49, Number: 76550
< 2017-10-10 07:00:10.500 Type: SSH_FXP_STATUS, Size: 49, Number: 76806
< 2017-10-10 07:00:10.500 Type: SSH_FXP_STATUS, Size: 49, Number: 77062
< 2017-10-10 07:00:10.578 Type: SSH_FXP_STATUS, Size: 40, Number: 77316
< 2017-10-10 07:00:10.578 Status code: 0
> 2017-10-10 07:00:10.578 Type: SSH_FXP_RENAME, Size: 104, Number: 77586
< 2017-10-10 07:00:10.609 Type: SSH_FXP_STATUS, Size: 37, Number: 77586
< 2017-10-10 07:00:10.609 Status code: 0
martin

Re: SEssion.SessionLogPath

It's TransferResumeSupportState_Off, not ResumeSupportState_Off.

A complete statement is like:
transferOptions.ResumeSupport.State = TransferResumeSupportState_Off
msdev7807

Re: SEssion.SessionLogPath

martin wrote:

The TransferResumeSupport was not set in this session. Are you actually using the transferOptions variable in your Session.PutFiles call? Show us your full code.


Thanks Martin, See code below

Set transferOptions = WScript.CreateObject("WinSCP.TransferOptions")
transferOptions.TransferMode = TransferMode_Binary
transferOptions.ResumeSupport.State = ResumeSupportState_Off
transferOptions.PreserveTimestamp = False


Set transferResult = session.PutFiles( strFileDirectory & strFileName, strFtpSiteDirectory, False, transferOptions)
martin

Re: SEssion.SessionLogPath

The TransferResumeSupport was not set in this session. Are you actually using the transferOptions variable in your Session.PutFiles call? Show us your full code.
msdev7807

Re: SEssion.SessionLogPath

martin wrote:

msdev7807 wrote:

Thanks Martin. I hope to upload the session log soon! Should I just send it to you via Private Message? I will have to de-identify / remove security information, etc.

You can mark the attachment as private.


Martin, I added a private attachment sample log.

Just a reminder that the folder we are uploading to on the FTP server has given us Execute and Write only permissions. We cannot read the files in the folder at all. That is where the resume file transmission is causing us problems ie creating .filepart extensions. Also there are periodic file sweeps going on on the FTP site folder. Again through the WinSCP client as in a previous post with the attached image, WinSCP uploads the file fine. Just not in VB Script because missing a property setting etc.

Please let me know what you find.

Thanks!
martin

Re: SEssion.SessionLogPath

msdev7807 wrote:

Thanks Martin. I hope to upload the session log soon! Should I just send it to you via Private Message? I will have to de-identify / remove security information, etc.

You can mark the attachment as private.
msdev7807

Session Log

Martin,

Is there any particular part of the log or keyword (such as resume,etc) that would identify the issue or that I should focus on?

Thanks!
msdev7807

SEssion.SessionLogPath

Thanks Martin. I hope to upload the session log soon! Should I just send it to you via Private Message? I will have to de-identify / remove security information, etc.

Thanks again!
msdev7807

Session Logging.

Sorry to be ignorant here. There is not a lot of detail documentation for VBS.
I added: (in Red)

Set oFTPSessionOptions = WScript.CreateObject("WinSCP.SessionOptions")
With oFTPSessionOptions
.Protocol = Protocol_Sftp
.PortNumber = 22
.HostName = "HostName"
.UserName = "User"
.Password = "password"
.SshHostKeyFingerprint = "ssh-code"
.SessionLogPath = "C:\Scripts\Logs\"
End With

And now it is giving me an error. Any ideas?
Thanks again for your help!
martin

Re: Still Having Issues

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.
msdev7807

Still Having Issues

Thanks for the reply...

The syntax didn't generate an error, however, it still didn't resolve my problem. I am still getting the .filepart files created and the file transfer is not completing properly. Just a additional piece of information, the host has only granted execute and write security on the folder we are uploading to. I believe this is why WinSCP is not able to reassemble the .filepart extensions back to the original file, because there is no read access to the folder on the host (which I am not sure why they do this, except for multiple clients upload to the same folder??)..

As in the previous thread, I attached the screen shot of the settings we need that work correctly when transferring the file via the WinSCP Client UI. Again just need to know how to accomplish the same functionality when scripting through VB Script.

Thanks!
msdev7807

Thank you for the reply. I entered the code in the same block as setting the transfermode, etc after creating the Transfer Options Object.

transferOptions.TransferResumeSupport.State = TransferResumeSupportState_Off

And I am receiving the following error (any ideas): Thanks!
martin

Re: Setting transferOptions.TransferResumeSupport in VB Script (VBS)

It should be:
transferOptions.ResumeSupport.State = TransferResumeSupportState_Off

See https://winscp.net/eng/docs/library_com_wsh#enums

Basically the same syntax you are already using for the TransferMode.
msdev7807

Setting transferOptions.TransferResumeSupport in VB Script (VBS)

This is basically what I need to set in VB Script:

See attached image. Indicate Disable in the first section Under Endurance Settings....
msdev7807

Setting transferOptions.TransferResumeSupport in VB Script (VBS)

We are uploading files to a FTP site via SFTP.
I need to set the TransferOptions.TransferResumeSupport So it doesn't break the file into the *.filepart segments.

Does anyone know the proper syntax to set the properties in VBS (VB Script)(below is what I attempted but the syntax isn't correct)?


Set transferOptions = WScript.CreateObject("WinSCP.TransferOptions")
transferOptions.TransferMode = TransferMode_Binary
transferOptions.TransferResumeSupport.State = TransferResumeSupport.TransferResumeSupportState.Off


Any help would be very much appreciated.

Thanks!