Connection works via GUI, but not via PowerShell

Advertisement

philcart
Joined:
Posts:
7

Connection works via GUI, but not via PowerShell

Hi

We have a client that is provisioning a new SFTP server in Amazon to replace their on-premises Windows SFTP server.

The problem we have is the script currently in use when upload to the old server, doesn't connect when we point it the new Amazon server. We're able to connect to the new server without any issues using the WinSCP GUI.

Hope someone has some ideas on what the problem could be.

Cheers
Phil
Description: Log file generated from connection via GUI
Description: PowerShell script used to make connection and put file
Description: Log file generated from executing script

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: Connection works via GUI, but not via PowerShell

You are using a different copy of winscp.exe in GUI and the script. Your local network/group/whatever policy may prevent the script copy of winscp.exe from connecting.

Also, how exactly do you use PowerShell script? Do you test it in the same environment, where you use the GUI?

And of course, double check the IP.

Reply with quote

philcart
Joined:
Posts:
7

Re: Connection works via GUI, but not via PowerShell

martin wrote:

You are using a different copy of winscp.exe in GUI and the script. Your local network/group/whatever policy may prevent the script copy of winscp.exe from connecting.

Also, how exactly do you use PowerShell script? Do you test it in the same environment, where you use the GUI?

And of course, double check the IP.

Thanks for the response martin.

Both the WinSCP GUI and the PowerShell script are being run on the same server.

The script is usually run from a Windows Scheduled Task. For testing the connection, I'm executing the script in PowerShell ISE.

The script is essentially whats attached to the original post. The only difference is we have a section that reads all the values from a config file for the different servers we connect to. It's the same script that's used for six other clients. It's only this new Amazon server that having issues.

Cheers
Phil

Reply with quote

martin
Site Admin
martin avatar

Re: Connection works via GUI, but not via PowerShell

Can you post a log file showing a working connection in PowerShell to one of the other servers?

Is it IPv4 or IPv6?

Reply with quote

philcart
Joined:
Posts:
7

Martin

Thanks for following this up. We actually got to the bottom of this late on Friday (our time).

Seems there were some issue with the host key fingerprint that we were using for the connection. Even though myself and another developer saw no difference in the script. When I copied and pasted the host key fingerprint again, it worked.

Just for completeness, I've also attached the log file from a successful transfer to the old server via our script.

Cheers
Phil

Reply with quote

Advertisement

martin
Site Admin
martin avatar

I'm glad that you have resolved the problem. But I do not see, what can your problem could have to do with a fingerprint. The log file shows that PowerShell did not even connect. No fingerprint is involved at that point. So it's rather that the connection problem was resolved somehow, and consequently a new problem (with the fingerprint) has emerged.

Reply with quote

Advertisement

You can post new topics in this forum