# Solved: question about plink



## kaizhang (Aug 5, 2008)

Is there a way to automatically accept updated key for plink?
I have a plant of test servers (about 100 and growing) needs rebuild on a regular basis. Openssh installs on them by default. If i wish to do something on them, i often use something like


```
cmd /c for /f %%a in (ips.txt) do plink %%a -l admin -pw passWO$d systeminfo | find "Install Date" > result.txt
```
The problem is that plink will ask me to accept updated key manually. Is there a way to suppress the interaction and have default answer as yes?
I tried a few switches, such as -batch, the connection simply drops. CAn't seem to find any answer on google. Anyone has a neat solution?


----------



## Regicide (Aug 8, 2003)

To my knowledge, plink will always ask for key authentication if the key is new. My only thought is that maybe you could have a static copy of each server's key. That way, after a rebuild, you would have the same key as before and not be asked to accept it.


----------



## kaizhang (Aug 5, 2008)

where can i get a static copy fo the server's key? Will the server generate a new key everytime it underwent an OS rebuilt?


----------



## Squashman (Apr 4, 2003)

With SSH you can setup Public key authentication so that you don't even need to use a username and password. Plenty of articles on the web on how to do this. This would probably help you with that. But in your case since you are constantly rebuilding machines, I pretty positive the key will change everytime. But if you are rebuilding the machine all the time, you could just re-setup the public key sharing after rebuilding the machine. Doesn't take to long.

I think this might work but I am not sure.

```
echo y|cmd /c for /f %%a in (ips.txt) do plink %%a -l admin -pw passWO$d systeminfo | find "Install Date" > result.txt
```
I guess you decided not to use the batch file I wrote for you the other day.


----------

