Jump to content

Automate ansering Yes to ssh keys using PSCP


Recommended Posts

I am new to AutoIt and not done much scripting before. I have around 600 devices that I need to push a firmware file to, and I have been trying to figure out how to automate answering yes a command prompt for each devices.

In a command prompt I use the following command for a single connection. The echo y before the pipe command will send a y to the command interpreter and accept the SSH keys.

echo y | pscp -v –scp –pw passwd C:\CNA1000\Firmware\CNA1504v1.1.7\CNA1504v1_1_7.run root@192.168.1.100:/tmp/.

I have tried adding this to a batch file and then adding a second device on the next line i.e.

echo y | pscp -v –scp –pw passwd C:\CNA1000\Firmware\CNA1504v1.1.7\CNA1504v1_1_7.run root@192.168.1.100:/tmp/. 
echo y | pscp -v –scp –pw passwd C:\CNA1000\Firmware\CNA1504v1.1.7\CNA1504v1_1_7.run root@192.168.1.101:/tmp/.

So with it this way, for some reason it keeps prompting for a user password and continues until I kill the batch.

I am looking for a way to use AutoIt to answer Yes so that I do not have to connect to some 600 plus devices once prior to running the firmware update.

 

Thanks,

Link to comment
Share on other sites

Let me know what questions you have.  It's been a long time since I used that code and I've adopted many scripting best practices and improved methods since then (*cough*--better comments and structure for one--*cough*).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...