I m trying to automate the download files from an SFTP server. It seems connection is ok since the commands like Get_SFTPChildItem shows me exactly what files are on the SFTP host and even GST-SFTPContent works fine.
But Get-SFTPItem ends with an error and I cannot find any solution on Google so far.
$Local = "C:\TEMP"
$Remote = "/"
$password = ConvertTo-SecureString -String $encrypted
$credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $username, $password
$session = New-SFTPSession -Computername $serverIP -Port $serverPort -Credential $credential -AcceptKey
Get-SFTPChildItem -SessionId $session.sessionId
Get-SFTPContent -Path /20221114105631_235259_778533771_1439649_transport.tiflow.accepted_203.xml -SessionId $session.sessionId -ContentType String
Get-SFTPItem -Destination $Local -Path $Remote -SessionId $session.SessionId
Error message:
Get-SFTPItem : De opgegeven padindeling wordt niet ondersteund.
At C:\Users\fons.VERVOERTRANS\Documents\Transporeon SFTP.ps1:13 char:1
- Get-SFTPItem -Destination $Local -Path $Remote -SessionId $session.Se ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [Get-SFTPItem], NotSupportedException
- FullyQualifiedErrorId : System.NotSupportedException,SSH.GetSftpItem