Hi, I am using PoverShell POSH-SSH module to connect to SFTP server.
I am getting error message about the credentials in the script. The credentials are ok, I have test them with WINSCP.
Text
Import-Module Posh-SSH
$username = "ftp"
$password = "Password" | ConvertTo-SecureString
$server = 10.0.0.1
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username,$password
New-SFTPSession -ComputerName $server -Credential $credential AcceptKey 1
I know that it is pretty basic but I do not understand how the credential string works.
I plan to upgrade this script to deploy a file to a SFTP server, but I believe that part I`ll be able to do myself.