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

mhucher

It worked!

That fixed my issue. Thank you, I appreciate your help!
martin

Re: .NET assembly TransferOption to limit speed of transfers

You are missing mirror and criteria parameters before the options parameter.
To pass the defaults, use:
$synchronizationResult =
    $session.SynchronizeDirectories(
        [WinSCP.SynchronizationMode]::Local, "C:\TestDirectory",
        "/Test/Data/", $False,
        $False, [WinSCP.SynchronizationCriteria]::Time,
        $transferoptions)


See Why are options provided to WinSCP .NET assembly methods in PowerShell being ignored?
Guest

.NET assembly TransferOption to limit speed of transfers

Hello. I am using the example PowerShell script from the .NET assembly documentation to synchronize directories, and I want to limit the bandwidth of the transfers. I have added the following lines for the TransferOptions:
$transferoptions = New-Object WinSCP.TransferOptions
$transferoptions.SpeedLimit = '1024'

And I added the $transferoptions to the end of the synchronize line:

$synchronizationResult =
    $session.SynchronizeDirectories(
        [WinSCP.SynchronizationMode]::Local, "C:\TestDirectory",
        "/Test/Data/", $False, $transferoptions)

[/code]
However, the transfers still seem to run at max bandwidth. I am assuming I have an incorrect syntax on the synchronization line, but the script does not throw any errors. Can you assist with an example of adding TransferOptions to the SynchronizeDirectories method, please?

I appreciate any guidance.