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

Unable to install the module Posh-ssh in Windows server

Open lakshmo123 opened this issue 3 years ago • 10 comments

Install-Module -Name posh-ssh -Force

showing the error as the term is not recognized as the name of a cmdlet

lakshmo123 avatar Nov 15 '21 06:11 lakshmo123

what does Get-Command Install-Module show ? what does $PSVersionTable show ?

MVKozlov avatar Nov 15 '21 06:11 MVKozlov

Get-Command Install-Module Get-Command : The term 'Install-Module' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • Get-Command Install-Module
  • CategoryInfo : ObjectNotFound: (Install-Module:String) [Get-Command], CommandNotFoundExceptio n
  • FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

$PsVersiontable

Name Value


PSVersion 4.0 WSManStackVersion 3.0 SerializationVersion 1.1.0.1 CLRVersion 4.0.30319.36627 BuildVersion 6.3.9600.19170 PSCompatibleVersions {1.0, 2.0, 3.0, 4.0} PSRemotingProtocolVersion 2.2

lakshmo123 avatar Nov 15 '21 08:11 lakshmo123

your powershell is v4.0 and you do not have powershellget installed so this is not posh-ssh problem

posh-ssh v3 does not support PSv4.0 but you can try

https://docs.microsoft.com/en-us/powershell/scripting/gallery/installing-psget?view=powershell-5.1#for-computers-running-powershell-30-or-powershell-40

MVKozlov avatar Nov 15 '21 12:11 MVKozlov

You need to be running PowerShell 5.1 or Powershell 7. Powershell 4 is not supported

Sent from my iPhone

On Nov 15, 2021, at 4:47 AM, lakshmo123 @.***> wrote:

 Get-Command Install-Module Get-Command : The term 'Install-Module' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

Get-Command Install-Module CategoryInfo : ObjectNotFound: (Install-Module:String) [Get-Command], CommandNotFoundExceptio n FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand $PsVersiontable

Name Value

PSVersion 4.0 WSManStackVersion 3.0 SerializationVersion 1.1.0.1 CLRVersion 4.0.30319.36627 BuildVersion 6.3.9600.19170 PSCompatibleVersions {1.0, 2.0, 3.0, 4.0} PSRemotingProtocolVersion 2.2

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

darkoperator avatar Nov 15 '21 12:11 darkoperator

@darkoperator It's funny, if remove Convert-SSHRegistryToJsonKnownHost и Get-SSHRegistryKnownHost (since they use classes) and lower the requirements for the version of the version to 4.0, it seems work :) at least it connects. just tested it

MVKozlov avatar Nov 15 '21 12:11 MVKozlov

Never expected.net standard to be that good

Sent from my iPhone

On Nov 15, 2021, at 8:37 AM, Max Kozlov @.***> wrote:

 @darkoperator It's funny, if remove Convert-SSHRegistryToJsonKnownHost и Get-SSHRegistryKnownHost (since they use classes) and lower the requirements for the version of the version to 4.0, it seems work :) at least it connects. just tested it

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

darkoperator avatar Nov 15 '21 12:11 darkoperator

.net standard 2.0 for win is just net 4.61+ :) https://docs.microsoft.com/en-us/dotnet/standard/net-standard

MVKozlov avatar Nov 15 '21 13:11 MVKozlov

your powershell is v4.0 and you do not have powershellget installed so this is not posh-ssh problem

posh-ssh v3 does not support PSv4.0 but you can try

https://docs.microsoft.com/en-us/powershell/scripting/gallery/installing-psget?view=powershell-5.1#for-computers-running-powershell-30-or-powershell-40

I need to run a few commands and export them into an excel file in the putty session. In which I need to connect the putty from RDP. so I need to install the posh-ssh module in order to run the script. Do I need to install the PowerShell 5.0?

lakshmo123 avatar Nov 16 '21 04:11 lakshmo123

If your host can be connected by Posh-SSH v2, you can install it manually or thru Save-Module from other computer with PSv5.1

Save-Module -Name Posh-SSH  -MaximumVersion 2.3 -Path d:\

where d:\ - path where module should be saved (D:\Posh-SSH\2.3.0)

or, if host supported only by Posh-SSH v3 (host signature not RSA), You need PS v5.1 or PSv7+

MVKozlov avatar Nov 16 '21 06:11 MVKozlov

@darkoperator, btw it seems to me that v3 should be published here in Releases

MVKozlov avatar Nov 16 '21 06:11 MVKozlov