Provide private key passhprase (password) for Posh-SSH New-SSHSession Provide private key passhprase (password) for Posh-SSH New-SSHSession powershell powershell

Provide private key passhprase (password) for Posh-SSH New-SSHSession


Posh-SSH will use "password" to decrypt encrypted private key.

$cred = New-Object System.Management.Automation.PSCredential($userName, $keyPassphrase)$sftp = New-SFTPSession -ComputerName $hostname -Credential $cred -KeyFile $keyFile

Key passphrase and password are provided the same way (bad design, imo). I'm afraid that using two-factor key+password authentication in Posh-SSH might be difficult, if possible at all.