"Upload of file '...' was successful, but error occurred while setting the permissions and/or timestamp" when using WinSCP .NET assembly in PowerShell "Upload of file '...' was successful, but error occurred while setting the permissions and/or timestamp" when using WinSCP .NET assembly in PowerShell powershell powershell

"Upload of file '...' was successful, but error occurred while setting the permissions and/or timestamp" when using WinSCP .NET assembly in PowerShell


The error is documented here:
https://winscp.net/eng/docs/message_preserve_time_perm

Your server does not support updating timestamps of uploaded remote files. So you need to instruct WinSCP not to attempt it:

$transferOptions = New-Object WinSCP.TransferOptions...$transferOptions.PreserveTimestamp = $False$session.PutFiles("D:\Users\bin\*.zip", "/Outbox/", $False, $transferOptions).Check()