I'm working on a script that requires calling Putty via Powershell using Plink.exe. However, we use auto-generated keys so I need to answer the "do you trust this security key" question when running my script.
I've found through this blog (http://www.virtu-al.net/2013/01/07/ssh-powershell-tricks-with-plink-exe/) you can use "echo y | plink.exe", however I'm not sure where to put this in the script to get it to work correctly. Any help would be appreciated!
Thanks!
The issue was the "-batch" option. Removing that fixed the issue.
Not sure what you mean, in Alan's post it shows how to pipe the 'y' to the invocation of plink.exe.
Perhaps you could show us your script, or at least the part where you plink.exe
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Use something like below. as you are using keys for ssh, no password is required.
Write-Output "yes" | PLINK.EXE -ssh $remoteserver -P 22 -pw $password -m $command
example: http://kunaludapi.blogspot.in/2014/01/install-rpm-on-redhat-linux-using.html
That is exactly what is written in Alan's blog post if I'm not mistaken ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The issue was the "-batch" option. Removing that fixed the issue.