I would like to encrypt a password in PowerShell and use it with plink and putty.
Yes, I know that it expects only cleartext password (Password encryption using SecureString for plink.exe command).
No, I will not use generated keys because we don't support it.
My questions:
- Any suggestions how can I use encrypted password for 
-pwflag inputtyorplink - Can I generate specific string as key? I mean taking current cleartext password and convert it to a key, then using it as 
-iinstead of-pw 
My securePass.ps1 code:
$password = read-host -prompt "Enter your Password" 
write-host "$password is password" 
$secure = ConvertTo-SecureString $password -force -asPlainText 
$bytes = ConvertFrom-SecureString $secure 
$bytes | out-file C:\encrypted_password1.txt
In main:
$securePass = Get-Content C:\encrypted_password1.txt
$pass = $securePass | ConvertTo-SecureString
plink -batch -ssh $defUser@$srv -pw $pass
putty -ssh $defUser@$srv -pw $pass