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

Got generic error Exception calling "MoveTo" with "1" argument(s): "Failure" during Move-SFTPItem #596

Open
Agent-E11 opened this issue Oct 9, 2024 · 0 comments

Comments

@Agent-E11
Copy link

$cred = New-Object System.Management.Automation.PSCredential ("<username>", (ConvertTo-SecureString -String '<password>' -AsPlainText -Force))
$session = New-SFTPSession -ComputerName host.domain.com -Credential $cred
Move-SFTPItem -SFTPSession $session -Path /outbox/testfile.txt -Destination /upload/archive
Exception calling "MoveTo" with "1" argument(s): "Failure"
At C:\Users\agent-e11\Documents\WindowsPowerShell\Modules\Posh-SSH\3.2.0\Posh-SSH.psm1:1393 char:17
+                 $itemInfo.MoveTo($Destination)
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SshException

This is a very generic error, and there is no hint as to what is wrong. I finally tried including the destination filename along with the directory, and it worked, but I think the error message should be more useful.

@Agent-E11 Agent-E11 changed the title Got error Exception calling "MoveTo" with "1" argument(s): "Failure" during Move-SFTPItem Got generic error Exception calling "MoveTo" with "1" argument(s): "Failure" during Move-SFTPItem Oct 9, 2024
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

1 participant