PowerShell: Unable to resolve package source | Ranjan.info

When you try to install PowerShell modules from PSGallery online, you may see the following error:

Install-Module SqlServer
WARNING: Unable to resolve package source '
PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'sqlserver. Try Get-PSRepository to see all available registered module repositories.

PowerShell Install-Module - Unable to resolve package source

The problem can occur on Windows 10, Windows Server 2016, or earlier Windows versions. The reason is that PowerShell by default tries to use a legacy and insecure TLS 1.0 protocol to connect to the PSGallery repository. As of April 2020, PowerShell Gallery accepts integration with NuGet Providers using TLS 1.2 only,

If TLS 1.0 and TLS 1.1 are not disabled in Windows, run the command below to use TLS 1.2 in the current PowerShell session:

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

TLS 1.2 is supported in all Windows versions starting with Windows 8 and Windows Server 2012. You can display a list of supported TLS versions in PowerShell:


supported tls version in powershell

To enable TLS 1.2 support in Windows 7 SP1/Windows Server 2008 R2, install KB3140245 and the MicrosoftEasyFix51044.msi fix.

You can now install or update modules from the PowerShell Gallery:

psgallery install module with tls 1.2 enabled

The next time you open your PowerShell console, you will need to re-enable the TLS 1.2 protocol. You can display the protocol version used for a connection in PowerShell as follows:


Powershell: Show current TLS version

To avoid having to enable TLS 1.2 every time you open PowerShell, you can change the default TLS version for the .NET Framework. To do this, make the following changes to the registry by using PowerShell:

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord

A similar error when installing PowerShell modules is described in the previous article Unable to download from URI.

Leave a Comment