Copy-WinSCPItem : Cannot bind argument to parameter 'Path' because it is null.

Advertisement

sellerdavid18@...
Guest

Copy-WinSCPItem : Cannot bind argument to parameter 'Path' because it is null.

Hi all, im tired of this error, mi code its really simple and i dont know whats wrong whit it.
Import-Module WinSCP
$credenciales = get-credential
$opciones = New-WinSCPSessionOption -HostName "ip_address" -Credential $credenciales -PortNumber "22" -SshHostKeyFingerprint "m6MF3ChDcoZjIxkzDKspcGprjm5qb5lwVhpYUZZlU/I"
$sesion = New-WinSCPSession -SessionOption $opciones
Write-Host "copy0"
$ruta = "\temp\file.csv"
Copy-WinSCPItem -Path $ruta -Destination "C:\Users\david_salamanca\Documents\folder"
Write-Host "copy1"
This its the error:
Copy-WinSCPItem : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\david_salamanca\Documents\Untitled1.ps1:8 char:1
+ Copy-WinSCPItem -Path $ruta -Destination "C:\Users\david_salamanc ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Copy-WinSCPItem], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Copy-WinSCPItem

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,034
Location:
Prague, Czechia

Re: Copy-WinSCPItem : Cannot bind argument to parameter 'Path' because it is null.

WinSCP PowerShell module is 3rd party library. We do not support it here.
But in general, Copy-WinSCPItem should copy remote file to another remote file. But you are passing two local/Windows paths to it. That does not seem correct.

Reply with quote

Advertisement

You can post new topics in this forum