Backtrack:  
 
by lunarg on February 21st 2023, at 09:48

When installing Powershell modules from the gallery, you may run into the following error, particularly on older versions of Windows (even Windows 10):

PS C:\WINDOWS\system32> Install-Module -Scope AllUsers -Name module-name
WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2/'.
PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'module-name'. Try Get-PSRepository to see all available registered module repositories.

The most common reason for this (aside of having some other issue with internet access) is that Powershell may still be using TLS 1.0, which is no longer supported by Powershell Gallery.

To fix this, you can set the protocol to use to TLS 1.2 via Powershell:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

The switch is immediate, meaning you can now try installing the module again.