Adding private key path to when synchronizing a two way delete

Advertisement

ecuso100
Joined:
Posts:
2

Adding private key path to when synchronizing a two way delete

Hello
I would like to inquire if it is possible to add a Private Key path to the script referred to here:
Two-way synchronization with delete with SFTP/FTP server

The script that needs to run does not seem to have an area to add a path to the private key.
powershell.exe -File C:\path\SynchronizeTwoWayDelete.ps1 -sessionUrl "sftp://user:password;fingerprint=ssh-rsa-xxxxxxxxxxx...@example.com/" -localPath "C:\local" -remotePath "/remote" -listPath "C:\cache\example.txt"
Is this possible?

Reply with quote

Advertisement

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

Re: Adding private key path to when synchronizing a two way delete

Either modify the script to construct SessionOptions with SshPrivateKeyPath property, the way I've already shown you on Stack Overflow:
Configure WinSCP PowerShell script to also include a private key

Or encode the key into the session URL:
sftp://user;fingerprint=ssh-rsa-xxxxxxxxxxx...@example.com;x-publickeyfile=C%3A%255Cmykey.ppk@example.com/
WinSCP GUI can generate such URL for you:
https://winscp.net/eng/docs/ui_generateurl#url

Reply with quote

Advertisement

You can post new topics in this forum