Posh-SSH icon indicating copy to clipboard operation
Posh-SSH copied to clipboard

Force parameter not working in 3.0 alpha

Open tbhel opened this issue 5 years ago • 4 comments

Running the 3.0 alpha on Powershell 7.1.1 on Ubuntu 20. When using the -Force parameter as such: New-SSHSession -ComputerName "10.1.2.28" -Credential $cred -Force I get an error message: New-SSHSession: Object reference not set to an instance of an object.

Removing the -Force parameter fixes the issue.

tbhel avatar Feb 04 '21 09:02 tbhel

Thanks will take a look.

Sent from my iPhone

On Feb 4, 2021, at 5:56 AM, tbhel [email protected] wrote:

 Running the 3.0 alpha on Powershell 7.1.1 on Ubuntu 20. When using the -Force parameter as such: New-SSHSession -ComputerName "10.1.2.28" -Credential $cred -Force I get an error message: New-SSHSession: Object reference not set to an instance of an object.

Removing the -Force parameter fixes the issue.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

darkoperator avatar Feb 04 '21 10:02 darkoperator

thanks, just pushed a fix to the source code b8e5d39d4d28e09afab5431173d8ade1452a54d6 it will be included in the next beta for the module

darkoperator avatar Feb 04 '21 13:02 darkoperator

@darkoperator, It should be fixed without code move just add ? symbol

var savedHostKey = Store?.GetKey(computer);

because result of foreach cycle used for filtering connectInfo.HostKeyAlgorithms before creating client. I cannot guarantee that this change have effect after client creation, just does not tested it

Update: I look into Renci code, It can be solved with move, but i like the "?" :)

MVKozlov avatar Feb 04 '21 15:02 MVKozlov

Yep already fixed :)

Sent from my iPhone

On Feb 4, 2021, at 11:51 AM, Max Kozlov [email protected] wrote:

 @darkoperator, It should be fixed without code move just add ? symbol

var savedHostKey = Store?.GetKey(computer); because result of foreach cycle used for filtering connectInfo.HostKeyAlgorithms before creating client. I cannot guarantee that this change have effect after client creation, just does not tested it

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

darkoperator avatar Feb 04 '21 16:02 darkoperator