Reputation: 11
I have written a script as below
$ipAddress = "10.10.10.10"
$username = Get-Content -Path "path to user name"
$password = Get-Content -Path " path to password"
$hostkeyF="aa:bb:cc:dd:ee:ff:gg:hh:JJ:kk:"
# Define the path to the Plink executable
$plinkPath = "C:\Program Files\PuTTY\plink.exe"
$sshCommand = "& '$plinkPath' -batch -ssh -hostkey $hostkeyF $username@$ipAddress -pw $password"
Invoke-Expression -Command $sshCommand
When I run it in PowerShell ISE I get error
Host key did not appear in manually configured list
What I am trying to do is create a PowerShell script which connects to a remote device later I will improve it.
But issue is I want all the user to use this code present in my network hence I want to bypass first time hostkey verification.
Sorry if I sound confusing
Let me know if you need any other details
Please note that I cannot install any new module to solve this as it is restricted.
I have OpenSSH and Plink with me to work on this.
Thank you in advance
Upvotes: 0
Views: 564
Reputation: 202504
With OpenSSH, you can use accept-new
mode.
ssh -o StrictHostKeyChecking=accept-new example.com
Plink does not have an equivalent functionality. All it supports is explicit specification of hostkey fingerprint using the -hostkey
switch.
Upvotes: 0