SCP unexpected filename error

Apr 14, 2013 at 2:05 PM
I'm adding SCP functionality to a PowerShell module I wrote, Downloading I have 0 problems from Unix and Linux hosts but uploading I'm getting a unexpected filename error. My code is bellow
    //Ceate instance of SCP Client with connection info
    var Client = new ScpClient(connectInfo);

    // Connect to  host using Connection info
    WriteVerbose("Connection succesfull");
    var localfullPath = Path.GetFullPath(localfile);
    if (File.Exists(localfullPath))
        WriteVerbose("Uploading "+localfullPath);
        FileInfo fil = new FileInfo(@localfullPath);

catch (Exception ex)
    throw ex;
Here is an example of the error:
C:\Users\Carlos> Set-SCPFile -ComputerName -Credential (Get-Credential) -LocalFile .\bashist.txt -Rem
oteFile /etc/ssh/sshd_config.bak -Verbose

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
VERBOSE: Using Username and Password authentication for connection.
VERBOSE: Connecting to with user root
VERBOSE: Connection succesfull
VERBOSE: Uploading C:\Users\Carlos\bashist.txt
Set-SCPFile : scp: error: unexpected filename: /etc/ssh/sshd_config.bak
At line:1 char:1
+ Set-SCPFile -ComputerName -Credential (Get-Credential) -LocalFile  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-SCPFile], ScpException
    + FullyQualifiedErrorId : Renci.SshNet.Common.ScpException,SSH.Set_SCPFile
Any idea why I could be getting this error?