VMware Cloud Community
bmccool
Enthusiast
Enthusiast
Jump to solution

Calling Putty via Powershell using Plink - how to auto answer the security key question

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!

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
bmccool
Enthusiast
Enthusiast
Jump to solution

The issue was the "-batch" option.  Removing that fixed the issue.

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
kunaludapi
Expert
Expert
Jump to solution

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

--------------------------------------------------------------- Kunal Udapi Sr. System Architect (Virtualization, Networking And Storage) http://vcloud-lab.com http://kunaludapi.blogspot.com VMWare vExpert 2014, 2015, 2016 If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
bmccool
Enthusiast
Enthusiast
Jump to solution

The issue was the "-batch" option.  Removing that fixed the issue.

0 Kudos