Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
452 views
in Technique[技术] by (71.8m points)

ssl - Cannot install TLS module in powershell

I'm trying to install TLS module of Powershell. I can see this module with command:

$> Get-Module -ListAvailabe TLS

    Directory: C:Windowssystem32WindowsPowerShellv1.0Modules


ModuleType Version    Name                                ExportedCommands                                                                                                                        
---------- -------    ----                                ----------------                                                                                                                        
Manifest   2.0.0.0    TLS                                 {New-TlsSessionTicketKey, Enable-TlsSessionTicketKey, Disable-TlsSessionTicketKey, Export-TlsSessionTicketKey}                          

But the installation command failed

Install-Module -Name TLS
PackageManagementInstall-Package : No match was found for the specified search criteria and module name 'TLS'. Try Get-PSRepository to see all available registered module repositories.
At C:Program FilesWindowsPowerShellModulesPowerShellGet2.0.3PSModule.psm1:9550 char:21
+ ...          $null = PackageManagementInstall-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

How to install this module?

question from:https://stackoverflow.com/questions/65892867/cannot-install-tls-module-in-powershell

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is no module by that name in the MS powershelgllery.com, to install.

Find-Module -Name '*tls*'
# Results
<#
Version Name              Repository Description                                                                                                       
------- ----              ---------- -----------                                                                                                       
0.1.0.0 BetterTls         PSGallery  PowerShell Module to Enable TLS 1.1 and 1.2 for Use in Windows PowerShell Where Neither are Enabled by Default    
1.0.0   Test-TlsProtocols PSGallery  Outputs the SSL/TLS protocols that the client is able to successfully use to connect to a server using fqdn or ip.
#>

This...

Get-Module -ListAvailable TLS

... is finding and loading modules, already on your system (in your $env:PSModulePath) for use, is this.

Import-Module -Name TLS

Or do this

Get-Module -ListAvailable TLS | 
Import-Module


Get-Command -Name '*tls*'
# Results
<#
CommandType     Name                                               Version    Source                                                                                              
-----------     ----                                               -------    ------                                                                                              
Cmdlet          Disable-TlsCipherSuite                             2.0.0.0    TLS                                                                                                 
Cmdlet          Disable-TlsEccCurve                                2.0.0.0    TLS                                                                                                 
Cmdlet          Disable-TlsSessionTicketKey                        2.0.0.0    TLS                                                                                                 
Cmdlet          Enable-TlsCipherSuite                              2.0.0.0    TLS                                                                                                 
Cmdlet          Enable-TlsEccCurve                                 2.0.0.0    TLS                                                                                                 
Cmdlet          Enable-TlsSessionTicketKey                         2.0.0.0    TLS                                                                                                 
Cmdlet          Export-TlsSessionTicketKey                         2.0.0.0    TLS                                                                                                 
Cmdlet          Get-TlsCipherSuite                                 2.0.0.0    TLS                                                                                                 
Cmdlet          Get-TlsEccCurve                                    2.0.0.0    TLS                                                                                                 
Cmdlet          New-TlsSessionTicketKey                            2.0.0.0    TLS  
#>

# Get specifics for a module, cmdlet, or function
(Get-Command -Name Get-TlsCipherSuite ).Parameters
(Get-Command -Name Get-TlsCipherSuite ).Parameters.Keys
Get-help -Name Get-TlsCipherSuite  -Examples
# Results
<#
Get-TlsCipherSuite
Get-TlsCipherSuite -Name "SSL"
#>
Get-help -Name Get-TlsCipherSuite  -Full
Get-help -Name Get-TlsCipherSuite  -Online

Packages are similarly discovered, loaded, and or installed:

Find-Package -Name '*tls*'

Update as per your comment about not seeing the cmdlets https://docs.microsoft.com/en-us/powershell/module/tls/?view=win10-ps

WS2K16 Win10 required.

PSVersion for the module/cmdlets:

<#
ModuleType Name CmdletName_FinctionName     PowerShellVersion
---------- ---- -----------------------     -----------------
Binary     TLS  Get-TlsEccCurve             5.1              
Binary     TLS  Get-TlsCipherSuite          5.1              
Binary     TLS  Export-TlsSessionTicketKey  5.1              
Binary     TLS  Enable-TlsEccCurve          5.1              
Binary     TLS  Enable-TlsCipherSuite       5.1              
Binary     TLS  Disable-TlsSessionTicketKey 5.1              
Binary     TLS  Disable-TlsEccCurve         5.1              
Binary     TLS  Disable-TlsCipherSuite      5.1              
Binary     TLS  Enable-TlsSessionTicketKey  5.1              
Binary     TLS  New-TlsSessionTicketKey     5.1 
#>

Update based on your comment on the OS version you are running.

The Get-TlsCipherSuite is not available on WS2K12 or W2K12R2 as per the MS Docs. Click the version drop-down to see the list.

WS2K12: https://docs.microsoft.com/en-us/powershell/module/tls/?view=win10-ps&viewFallbackFrom=winserver2012-ps

W2K12R2: https://docs.microsoft.com/en-us/powershell/module/tls/?view=winserver2012r2-ps


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...