Powershell – Install-PackageProvider – NuGet – Error – “WARNING: MSG:UnableToDownload”

Background

Tried installing the SQLServer module for Powershell, but ran into a stumbling error.

 

Error Recreation

The command for installing the SQLServer module for Powershell is simple enough.

It goes:-

Powershell -Command "Install-Module -Name sqlServer"

Our error reads:-

NuGet provider is required to continue

Errors

Error Message – WARNING: MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «»

Error Message – Image

Error Message – Textual


>powershell -Command "Install-Module -Name sqlServer -AllowClobber"

NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet
 provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\dadeniji\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by
running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install
and import the NuGet provider now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y
WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider
'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package
has the tags.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7405 char:21
+ ...     $null = PackageManagement\Install-PackageProvider -Name $script:N ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-Pac
   kageProvider], Exception
    + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackagePro
   vider

PackageManagement\Import-PackageProvider : No match was found for the specified search criteria and provider name
'NuGet'. Try 'Get-PackageProvider -ListAvailable' to see if the provider exists on the system.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7411 char:21
+ ...     $null = PackageManagement\Import-PackageProvider -Name $script:Nu ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (NuGet:String) [Import-PackageProvider], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProv
   ider

WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
PackageManagement\Get-PackageProvider : Unable to find package provider 'NuGet'. It may not be imported yet. Try
'Get-PackageProvider -ListAvailable'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7415 char:30
+ ... tProvider = PackageManagement\Get-PackageProvider -Name $script:NuGet ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...PackageProvider:GetPackageProvider) [Get-PackageProvi
   der], Exception
    + FullyQualifiedErrorId : UnknownProviderFromActivatedList,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPacka
   geProvider

Install-Module : NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201'
or newer version of NuGet provider is installed.
At line:1 char:1
+ Install-Module -Name sqlServer -AllowClobber
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Install-Module], InvalidOperationException
    + FullyQualifiedErrorId : CouldNotInstallNuGetProvider,Install-Module


>

 

Error Explanation

  1. Install-Module : NuGet provider is required to interact with NuGet-based repositories. Please ensure that ‘2.8.5.201’ or newer version of NuGet provider is installed.
    • Pretty Clear
    • We need the Nuget provider to be able to access NuGet repositories
    • As per version number, we need a minimum version number of 2.8.5.202

 

TroubleShooting

Outline

  1. Nuget
    • Inquire
      • Get-PackageProvider
    • Install
      • Install PackageProvider – NuGet
  2. Network
    • Configuration
      • Security Protocol
  3. .Net Framework
    • Configuration
      • Use Strong Cryptography

NuGet

Inquire

List Installed Package Providers

Objective

Using the Get-PackageProvider command, let us review registered package providers.

Syntax

powershell -Command "Get-PackageProvider -ListAvailable"

Sample

powershell -Command "Get-PackageProvider -ListAvailable"

Output
Output – Image

Output – Text
 

>powershell -Command "Get-PackageProvider -ListAvailable"

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, ...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

Explanation
  1. The package providers listed are
    • msi
      • Microsoft Windows Installer ( *.msi )
    • msu
      • Microsoft Software Updates ( *.msu )
    • PowerShellGet
    • Programs
  2. Compicisouly missing
    • NuGet

 

Install

Install Package Provider – NuGet

Objective

Using the Install-PackageProvider commander, let us attempt to install NuGet as a package provider.

Syntax

powershell -Command "Install-PackageProvider -Name [package-provider]"

Sample

powershell -Command "Install-PackageProvider -Name NuGet"

 

Error Message – WARNING: MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «»
Error Message – Image

Error Message – Text

>powershell -Command "Install-PackageProvider -Name NuGet"

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.
WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package
provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.
At line:1 char:1
+ Install-PackageProvider -Name NuGet
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-PackageProvider], Exception
    + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider

Error Explanation

When we attempt to install the Nuget package provider, we get a replay of the same error that we encountered earlier.

That is the error we received when trying to install the PowerShell SQLServer Module.

  1. Install-Module : NuGet provider is required to interact with NuGet-based repositories. Please ensure that ‘2.8.5.201’ or newer version of NuGet provider is installed.
    • Pretty Clear
    • We need the Nuget provider to be able to access NuGet repositories
    • As per version number, we need a minimum version number of 2.8.5.202

 

Network

Configuration

SecurityProtocol

Outline
  1. Inquire
  2. Set
Inquire
Syntax

powershell -Command "[Net.ServicePointManager]::SecurityProtocol"

Sample

powershell -Command "[Net.ServicePointManager]::SecurityProtocol"

Output
Output – Image

Output – Textual
 

Tls, Tls11

Explanation
  1. The following network security protocols are enabled
    • TLS
    • TLS11
Set
Syntax

powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::[protocol]; [Net.ServicePointManager]::SecurityProtocol"

Sample

powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; [Net.ServicePointManager]::SecurityProtocol"

Output
Output – Image

Output – Textual
 

Tls12

Explanation
  1. For the current session, we have managed to set our network protocol to Tls12

 

 

.Net Framework

Configuration

Use Strong Cryptography

Outline
  1. .Net Framework ( v4 and above )
    • Set to use strong cryptography
      • bitness
        • 64-bit
        • 32-bit
Set
Sample

Rem Set strong cryptography on 64 bit .Net Framework (version 4 and above)

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

Rem set strong cryptography on 32 bit .Net Framework (version 4 and above)

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

Output
Output – Image

 

Output – Textual
 


Explanation
  1. If everything goes well, you will not see anything
  2. Please make sure you are using Administrator Command Shell
    • In so doing, you will have elevated security permission working on your behalf

 

Special Commendation

As always there is always Hero.

This is one of those places, where we do not hate on our heroes.

Niels Weistra

This post’s hero is Niels Weistra.

Bro did not let up until he got us home.

 

Summary

It appears that Microsoft tightened up security protocol requirements on some of its HTTP endpoints.

That heightened requirement “broke” the .Net Framework that underpins Powershell.

Broke in the sense that one of its default settings is no longer sufficient to access “secured” HTTP endpoints.

 

Referenced Work

  1. Microsoft
    • Microsoft | Community
      • Trying to install program using Powershell and getting this error
        Link

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s