Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Connecting to SFTP server with PowerShell.

$
0
0

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.


Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>