Tinus EngOps Wiki

Logo

OpsaC - Operating as PowerShell code

Links

Home

PowerShell Blog

PowerShell Index

PowerShell Search

Additional Websites

View my GitHub Profile

View my GitHub Gists

View Tinus IT Wiki

View my Photo Website

No match was found for the specified search criteria and module name

published: November 29, 2020 author: Tinu tags: PowerShell categories: PowerShell-Errors


Table of Contents

No match was found for the specified search criteria and module name

Find-Module could not connect to the specified uri in the registered repositories.

Problem

Find-Module -Name PSWriteHTML

PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'PSWriteHTML'.
Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2\PSModule.psm1:8871 char:9
+ PackageManagement\Find-Package @PSBoundParameters | Microsoft ...
+ CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage

Cause

TLS 1.2 is set to be the default for the PowerShell Gallery since April 2020, but this is not set on the computer.

Solution

To Fix TLS issue on the current session, run below command:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
[4] I  PS U:\ > Find-Module -Name PSWriteHTML

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
0.0.122              PSWriteHTML                         PSGallery            Module that allows creating HTML content/reports ...

or set strong cryptography on .Net Framework (version 4 and above) for all sessions in the future:

try{
    $value = Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto'
}catch{
    $value = 0
}
if($value -ne 1){
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
}

try{
    $value = Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto'
}catch{
    $value = 0
}
if($value -ne 1){
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
}
Restart-Computer

See also

PowerShell Gallery TLS Support


← Previous Post [ Top ] Copyright © 2024 by tinuwalther [ Blog ] Next Post →