I am using Transferetto module to download SFTP files, it is able to connect to server and list the server files but throwing error while downloading with below error:- Receive-SFTPFile : A parameter cannot be found that matches parameter name 'RemoteFile'. My script is like below:-
Set-ExecutionPolicy RemoteSigned -Scope Process -Force
Import-Module Transferetto
$SftpClient = Connect-SFTP -Server '100.100.00.00' -Username 'FRG_100_22' -Password 'dfggrty'
$List = Get-SFTPList -SftpClient $SftpClient -Path '/FRG'
Get-Childitem -Path "\\data\files" | Remove-Item
$downloadedFiles = @()
# Download multiple files into directory
foreach($originalSFtpFile in $list) {
$downloadedFile = Receive-SFTPFile -SftpClient $SftpClient -RemoteFile $originalSFtpFile -LocalPath "\\data\files" -LocalExists Overwrite -VerifyOptions Retry, None
Write-Host "Downloaded file $($originalSFtpFile.Name) in folder $($downloadedFile.LocalPath)"
$downloadedFiles += ($downloadedFile)
}
Disconnect-SFTP -SftpClient $SftpClient