0

I'm creating a script that will run unnatended on Windows. The script needs to execute commands via SSH on an appliance. The appliance does not support public/private key authentication only password authentication is supported. The script will need to execute some commands via SSH and capture the results (via stdout). The script will be run on Windows and will use built-in Windows SSH Client, this is preferred for the compliance reason, but if a different client can do the job I would also like to know.

I need a way to bypass the password propmpt, so that the password is supplied by the script. How can this be achieved?

What I have considered:

  • Public Key Authentication - is not supported by the appliance
  • Use putty - needs to be completelly unattended
  • sshpass - does not work on windows
  • WSL - requires Hyper-V and the machine has VmWare on it which is incompatible, also was hoping for something simpler
3
  • There are some Powershell SSH implementations you might be able to use.
    – Zoredache
    Dec 2, 2021 at 8:03
  • @Zoredache Thank you. There is only one, and this is the one I linked in the question. It is the same as this and this If there are others, please let me know. Also would be interesting to learn, what in those implementations you mentioned would help. Dec 3, 2021 at 1:08
  • I was thinking of something like Posh-SSH which uses the .NET ssh library instead of OpenSSH. github.com/darkoperator/Posh-SSH github.com/sshnet/SSH.NET
    – Zoredache
    Dec 4, 2021 at 9:10

1 Answer 1

1

Would the tool 'expect' be an option for you? As far as I know it runs on Linux but is also ported to Windows. Using this tool you can capture output and react on it with eg. some input. Maybe this post addresses your need: https://hostadvice.com/how-to/how-to-automate-tasks-in-ssh/

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .