Fingerprint
Hello Sir
Many thanks
Arnold
Many thanks
Arnold
SessionOption.SshHostKeyFingerprint
, if you care about security.
SshHostKeyPolicy.GiveUpSecurityAndAcceptAny
.
$hostname = 'ftp://.........'
$username = '.............'
$password = '.............'
$fingerprint = '$yourFingerprint' # eqal is obsolete her ????
$PortNumber = "22"
SessionOptions.SshHostKeyFingerprint
directly from the Get-WinSCPHostKeyFingerprint
, without some verification or caching!
cls
Get-Module winscp | ft Path
$hostname = 'ftp://.........'
$username = '.............'
$password = '.............'
$fingerprint = 'yourFingerprint'
$PortNumber = "22"
$WinSCPSessionOption = New-WinSCPSessionOption -Property @{
Protocol = [WinSCP.Protocol]::Sftp # Transfer Protocols (SFTP, FTP, SCP, WebDAV, S3)
HostName = $using:hostname
UserName = $using:username
SecurePassword = $using:password
PortNumber = $using:PortNumber
}
$sshHostKeyFingerprint = Get-WinSCPHostKeyFingerprint -SessionOption $WinSCPSessionOption -Algorithm SHA-256
$WinSCPSessionOption.SshHostKeyFingerprint = $sshHostKeyFingerprint
$WinSCPSession = New-WinSCPSession -SessionOption ($WinSCPSessionOption)
Get-WinSCPSession
Receive-WinSCPItem -WinSCPSession $WinSCPSession -RemotePath "/" -LocalPath "C:\Users\admin\OneDrive\......."
$WinSCPSessionOption.SshHostKeyFingerprint = $sshHostKeyFingerprint
Remove-WinSCPSession