darkoperator / darkoperator/Posh-SSH

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

Open
#596 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1.1k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

$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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Move-SFTPItem in Posh-SSH.psm1 around line 1393, where $itemInfo.MoveTo($Destination) raises the generic SshException. Reproduce the command using a directory destination versus an explicit destination filename, then make the resulting error identify the invalid or incomplete destination and verify the reported scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.