Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error occurred while setting the permissions and/or timestamp.** #127

Closed
Gaz2600 opened this issue Apr 15, 2020 · 5 comments
Closed

error occurred while setting the permissions and/or timestamp.** #127

Gaz2600 opened this issue Apr 15, 2020 · 5 comments

Comments

@Gaz2600
Copy link

Gaz2600 commented Apr 15, 2020

Please fill in the following fields, replacing the values inside the brackets {{ }}.

Issue Description

We have a new service whos sftp server is giving me an error when uploading "error occurred while setting the permissions and/or timestamp.**" from what I've found you need to use new-winscptransferoption and new-winscpitempermission however I've not been able to get them to work

Example

$transOptions = New-WinSCPTransferOption -PreserveTimestamp:$false -FilePermissions (New-WinSCPItemPermission -UserRead -UserWrite -GroupRead -OtherRead)

Send-WinSCPItem -WinSCPSession $session -Path $srcStuHmLang -Destination $filename -TransferOptions $transOptions 


Send-WinSCPItem : WinSCP.SessionRemoteException: **Upload of file 'ParentSquare_Student-HmLang-Cell.csv' was successful, but error occurred while setting the permissions and/or timestamp.**
If the problem persists, turn off setting permissions or preserving timestamp. Alternatively you can turn on 'Ignore permission errors' option.
The server does not support the operation.
Error code: 8
Error message from server (US-ASCII): SETSTAT unsupported
At line:1 char:9
+         Send-WinSCPItem -WinSCPSession $session -Path $srcStuHmLang - ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Send-WinSCPItem

Expected Output

{{ Please provide what expect to happen. }}

Actual Output

{{ Please provide what actually happened. }}

WinSCP-PowerShell Version

Version 5.13.9.1

Environment

Windows 2019 Datacenter 64 bit

Name : Windows PowerShell ISE Host
Version : 5.1.17763.1007
InstanceId : 4f74bab2-88e8-451b-ac18-0396ca43d083
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.Host.ISE.ISEOptions
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace

The FTP server is managed AWS SFTP server

@tomohulk
Copy link
Owner

Lets see if we can figure this out, I haven't seen this exact issue, I also don't have an AWS sub, so its going to be hard for me to test.

first, can you update to the latest WinSCP PowerShell Module Version, 5.17.2.0, you are quite a few versions behind.
if you downloaded it from the powershell gallery, just do Update-Module WinSCP
else you can grab it from the releases section here on the project page.

next, try just using the transfer options, I don't think you need to change the permissions at all

$transOptions = New-WinSCPTransferOption -PreserveTimestamp:$false

lte me know how it goes. thanks.

@Gaz2600
Copy link
Author

Gaz2600 commented Apr 15, 2020

That appears to have allowed the transfer when I ran a small portion of the script but running the entire script I now get a new error:

`New-WinSCPSession: Exception calling "Open" with "1" argument(s): "The version of C:\Program Files\WindowsPowerShell\Modules\WinSCP\5.17.2.0\Public..\bin\winscp.exe (5.17.2.0) does not match version of this assembly
C:\Program Files\WindowsPowerShell\Modules\WinSCP\5.13.9.1\lib\WinSCPNet.dll (5.13.9.0)."
At E:\ParentSquare\PS\ParentSquare.ps1:51 char:16

  • $Session = New-WinSCPSession -SessionOption $SessionOptions
    
  •            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [New-WinSCPSession], MethodInvocationException
    • FullyQualifiedErrorId : SessionLocalException,New-WinSCPSession`

@tomohulk
Copy link
Owner

you need to close and reopen your console, the old dll is still loaded. you can also just go delete C:\Program Files\WindowsPowerShell\Modules\WinSCP\5.13.9.1 if you want to be sure

@Gaz2600
Copy link
Author

Gaz2600 commented Apr 15, 2020

ah excellent, easy fix. everything appears to be working now, thank you!

@tomohulk
Copy link
Owner

hey no problem, glad its working for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants