I'm struggling with a strange issue and I can't see what's wrong and hoping if someone can put some lights.
I have few PowerShell scripts to download data from a web server, the problems I'm having.
I'm using SSH key and stored in the same machine.
Each time when I tried to run PowerShell scripts it comes up with the error says (doesn't let me log in) "error connecting"
Each time when I'm using the same user credentials via GIT BASH it works fine (lets me log in) from the same PC
Using the same user credentials via Filezilla (sftp) doesn't let me connect.
Problem: Powershell can't connect so can't download from the path.
The script I'm using
# defines all variables (we don't acctually need the user and password as we are using a SSH key, but it prompts for user and password despite that, so i left it here just for the sake of it) $today = get-date -Format dd-MM-yyyy $password = "PASSWORD" $User = "USERNAME" $computername = "DOmain.com" $website = "WEBSITE" $key = 'C:\User\Admin\.ssh\exported-openssh' $source = "/home/USERNAME/www/domain.com/backup/$today" $port = "1000" # ---------------------------- Shouldn't be a need to edit code beyond this point ------------------------- $year = get-date -Format yyyy $localbackup = "E:\Backups\$year\Websites\$website\" $localreport = "E:\Backups\$year\Reports\" $path = "E:\Backups\$year\Reports\$today" $errorlog = "E:\Backups\$year\Reports\$today\Error-logs" $localreportfile = "E:\Backups\$year\Reports\$today\$today-$website.txt" $destination = "E:\Backups\$year\Websites\$website\$today" $timestamp1 = get-date