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

JW

Fixed

Must provide all SynchronizeDirectories parameter.
JW

Powershell SynchronizationMode speed limit not work

I have follow the below link to setup Synchronization by powershell and try to limit the speed. I have enabled the transferOptions object but it not work.....

https://winscp.net/eng/docs/library_session_synchronizedirectories#powershell

try
{
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::Sftp
HostName = "example.com"
UserName = "user"
Password = "mypassword"
SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
}

$session = New-Object WinSCP.Session
try
{
# Will continuously report progress of synchronization
$session.add_FileTransferred( { FileTransferred($_) } )

# Connect
$session.Open($sessionOptions)

$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.SpeedLimit = 10

# Synchronize files
$synchronizationResult = $session.SynchronizeDirectories(
[WinSCP.SynchronizationMode]::Remote, "d:\www", "/home/martin/public_html", $False, $transferOptions)

# Throw on any error
$synchronizationResult.Check()
}
finally
{
# Disconnect, clean up
$session.Dispose()
}

exit 0
}