Home Ask Login Register

Developers Planet

Your answer is one click away!

Jay February 2016

WinSCP Disable ResumeSupport in PowerShell

I am using WinSCP to write to connect a SQL Server to an SFTP server. I am trying to write a file to an SFTP server where I only have write access, not modify. I am having a problem because I get back

Cannot create remote file '/xxx.filepart'.

The documentation suggests this is because I do not have modify access to the target directory. I did this WinSCP -> Preferences -> Endurance -> Disable
I checked the winscp.ini file and ResumeSupport is 2 (I believe this means disabled). I ran "echo $transferOptions.ResumeSupport" and it says that it is in a default state.

I have checked this documentation:

However, I don't see a PowerShell example, just C#.

I have tried various permutations of $transferOptions.ResumeSupport.State = Off, $transferOptions.ResumeSupport.Off, and whatnot. One of these says that it's read-only.

I know $transferOptions is a variable here but it comes from the default script. The object determines transfer options $transferOptions = New-Object WinSCP.TransferOptions

Thanks in advance for help

edit: The overall problem is I only have write access to the server, but not modify. I am getting a new error: "Cannot overwrite remote file '/xxx'.$$. It looks like the dollar signs are some sort of temp file that it's trying to create. Is there a way to disable whatever setting is causing this?


Martin Prikryl February 2016

Syntax for using enumeration in PowerShell is described in article Using WinSCP .NET assembly from PowerShell.

Enumeration values are accessed using static field syntax [Namespace.Type]::Member, for example [WinSCP.Protocol]::Sftp.

You can find a PowerShell example for TransferResumeSupport.State in Converting to .NET assembly section of get and put command documentation:

$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.ResumeSupport.State = [WinSCP.TransferResumeSupportState]::Off
$session.GetFiles(..., ..., $False, $transferOptions).Check()

Post Status

Asked in February 2016
Viewed 3,163 times
Voted 8
Answered 1 times


Leave an answer

Quote of the day: live life