OpsaC - Operating as PowerShell code
published: November 29, 2020 author: Tinu tags: PowerShell categories: PowerShell-Errors
Find-Module could not connect to the specified uri in the registered repositories.
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
TLS 1.2 is set to be the default for the PowerShell Gallery since April 2020, but this is not set on the computer.
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
PowerShell Gallery TLS Support