Visual Studio Code Error "No match was found for the specified search criteria and module name PackageManagement"

Visual Studio Code asks to perform an update when launching the PowerShell Integrated Console. The Update fails with the following error message:

PS> powershell.exe -NoLogo -NoProfile -Command 'Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber'

PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'PackageManagement'. Try Get-PSRepository to see all available registered module repositories.

Get-PSRepository returns the following error:

> Get-PSRepository
WARNING: MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «»
WARNING: Unable to download the list of available providers. Check your internet connection.

The problem was not related to internet connectivity issues but to a changed encryption standard. The PowerShell Gallery has deprecated Transport Layer Security (TLS) versions 1.0 and 1.1 as of April 2020. Some systems are not enabled to use TLS 1.2.

Verify TLS 1.2 Support
Run [Net.ServicePointManager]::SecurityProtocol in your PowerShell Console to verify supported TLS versions. Check that Tls12 is in the list.

PS> [Net.ServicePointManager]::SecurityProtocol
Tls12

Enable TLS 1.2 Support
If Tls12 is not included, run the following commands in an administrative PowerShell session:

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

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.