Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: -hostkey signature error "whitespace"

This is rather a PowerShell question.

Anyway this works:
D:\winscp\WinSCP.com /log=D:\winscp\winscp.log /command "open sftp://user:password@address -hostkey=`"`"ssh-ed25519$s256$snpaaxdsra.....EmNyc=`"`"" "put $zfile /data/folder/" "exit"

Actually documented here:
https://winscp.net/eng/docs/commandline#syntax
zikosoft

I've executed the script in PowerShell external it worked and it not worked inside SQL Server (PowerShell) it's a problem of certificate because the first one used it from cache.

Any idea how to add the certificate on SQL Server?
zikosoft

For information I can send file using PowerShell but not from the SQL Server Job Agent (that use PowerShell).

I replaced the spaces with a variable $s=" "
D:\winscp\WinSCP.com /log=D:\winscp\winscp.log /command "open sftp://user:password@address -hostkey=""ssh-ed25519$s256$snpaaxdsra.....EmNyc=""" "put $zfile /data/folder/" "exit"

Any idea?
zikosoft

-hostkey signature error "whitespace"

Hi,

I'm trying to upload a file to a remote server.

For information I'm using Microsoft SQL Server (job task) that use PowerShell.

So when I concatenate the parameters PowerShell do not ignore the whitespace and it cut it, Ex:
D:\winscp\WinSCP.com /log=D:\winscp\winscp.log /command "open sftp://user:password@address -hostkey=""ssh-ed25519 256 npaaxdsra.....EmNyc=""" "put $zfile /data/folder/" "exit"

It give an error:
(Exception) **Host key does not match configured key

Because the hostkey passed do not match with the key that I sent (from the log).
Script: open sftp://user:***@address/ -hostkey=ssh-ed25519

It cut everything after the whitespace, I tested with a lot of combinations and nothing..

ex: ` | &('..')

For information all that I found is escaping the whitespace in the file path not in the parameters (theoretically it's the same) ex:
PowerTip: Run a PowerShell Script with Space in the Path - Scripting Blog [archived]
This is the documentation page: https://winscp.net/eng/docs/scripting

Any help will be so appreciated
Thanks