skip to Main Content

Unable to install NuGet provider for PowerShell

Before installing EXO V2 module, we need to install the PowerShellGet module. The problem is that we are unable to install NuGet provider and a couple of errors are showing. Warning unable to download from URI, unable to download the list of available providers. After the errors, it did not install. In this article, you will learn why this is happening and the solution for installing NuGet provider for PowerShell.

Unable to install NuGet provider for PowerShell

Run PowerShell as administrator. Run the command Install-Module PowershellGet -Force. When asked to install NuGet provider, press Y and follow with Enter.

After pressing Y and follow with Enter, the output is giving us the following warnings.

  • WARNING:  Unable to download from URI.
  • WARNING: Unable to download the list of available providers. Check your internet connection.
  • Unable to find package provider ‘NuGet’. It may not be imported yet.
Why are we getting this error and what is the solution for unable to install and download NuGet provider?

Find PowerShell version

Find the PowerShell version that is running on the system. We are going to use the Get-Host cmdlet in Windows Server 2016.

PowerShell 5.1 enables SSL 3.0 and TLS 1.0 for secure HTTP connections by default. Let’s confirm that with the next step.

Check Transport Layer Security protocols

Check the supported security protocols on the system.

As we can see, the security protocols defined in the system are SSL 3.0 and TLS 1.0. Both of the security protocols are deprecated.

Transport Layer Security protocols

See a list of the security protocols and when they are published including the current status. At the moment of writing, only TLS 1.2 and TLS 1.3 are approved.

Solution for unable to install NuGet provider for PowerShell

Now that we gathered all the information, we are going to enable TLS 1.2 on the system. Run both cmdlets to set .NET Framework strong cryptography registry keys. After that, restart PowerShell and check if the security protocol TLS 1.2 is added. As of last, install the PowerShellGet module.

The first cmdlet is to set strong cryptography on 64 bit .Net Framework (version 4 and above).

The second cmdlet is to set strong cryptography on 32 bit .Net Framework (version 4 and above).

Restart Powershell and check for supported security protocols.

Run the command Install-Module PowershellGet -Force and press Y to install NuGet provider, follow with Enter.

NuGet provider did download successfully. Did it work for you?

Conclusion

In this article, you learned why you are unable to install NuGet provider for PowerShell. The solution to this problem is configuring TLS1.2 or higher on the system. After that, you can install NuGet for PowerShell. Did you enjoy this article? You may also like Cleanup Exchange logs automatically with scheduled task. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect and IT Consultant. His specialism is designing and building complex enterprise environments. He started Information Technology at a very young age, and his goal is to teach and inspire others. Connect with ALI TAJRAN on social media. Read more »

This Post Has 33 Comments
  1. or we can use:
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    in ps session and then reinstall needed module …

  2. Good info, but I still cant install Nuget because PowerShell assumes that you are connected to the Internet. Not all servers are connected to the Internet. This is a stupid prerequisite just to install a PS module. Why is Microsoft requiring this?

  3. Thanks. I’m having trouble installing the latest version of ML.NET Builder (Beta) and I couldn’t install the Azure PowerShell module that was needed by it. Your post at least let me run the following command after updating PowershellGet per your instructions:
    Install-Module -Name Az

  4. Hi, I can see Tls12 but when I execute Install-Module PowershellGet -Force after closing and opening again Powershell ISE i get this message:
    WARNING: The version ‘1.4.7’ of module ‘PackageManagement’ is currently in use. Retry the operation after closing the applications.

    I cannot install Nuget provider.

    1. Find out if the PowerShell module is already installed on the system. Run PowerShell as administrator and run the following cmdlet:
      Get-InstalledModule

      Do you see the module PowerShellGet in the Name column? If yes, it means that it’s already installed.

      If not, run the following cmdlet:
      Install-Module PowerShellGet -RequiredVersion 2.2.4 -SkipPublisherCheck

      Let me know the results!

      1. Hi, thank for your answer. The PowerShellGet is already installed, but on the module browser I see NuGet-anycpu.exe is required. The problem still persist, and I’m not able to execute my script due this error:
        Exception calling “AcquireToken” with “4” argument(s): “Loading an assembly required for interactive user authentication failed. Make sure assembly
        ‘Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms,

        I think both errors are correlated.

  5. Hi Ali,

    Many thanks. your solution worked out perfectly for me on getting this dreaded nuget install which was causing me grief. Wish you well.

  6. I have followed same procedure what you mention but still i am facing error

    PS C:\> Get-Host | Select-Object Version

    Version
    ——-
    5.1.17134.858

    PS C:\> [Net.ServicePointManager]::SecurityProtocol
    Ssl3, Tls
    PS C:\> Set-ItemProperty -Path ‘HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319’ -Name ‘SchUseStrongCrypto’ -Value ‘1’ -Type DWord
    PS C:\> Set-ItemProperty -Path ‘HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319’ -Name ‘SchUseStrongCrypto’ -Value ‘1’ -Type DWord
    PS C:\> [Net.ServicePointManager]::SecurityProtocol
    Ssl3, Tls
    PS C:\> Install-Module PowershellGet -Force

    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\Ram_Vignesh\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:7468 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:7474 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:7478 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 PowershellGet -Force
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [Install-Module], InvalidOperationException
    + FullyQualifiedErrorId : CouldNotInstallNuGetProvider,Install-Module

    1. Did you restart PowerShell after running both the Set-ItemProperty cmdlets?

      If you did a restart of PowerShell and it’s still not working, do the following:

      Run PowerShell as administrator and run the command:
      [Net.ServicePointManager]::SecurityProtocol

      What does the above command show you as output?

      If it does not show you TLS12, it will not work.

      Run the command:
      [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

      This time, don’t close PowerShell as this command is a per-session setting.

      Again run the command:
      [Net.ServicePointManager]::SecurityProtocol

      Does it show you TLS1.2 now? If yes, run the command:
      Install-Module PowershellGet -Force

      I hope that this worked.

    1. Run PowerShell as administrator and run the command:
      [Net.ServicePointManager]::SecurityProtocol

      What does the above command show you as output?

      If it does not show you TLS12, it will not work.

      Run the command:
      [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

      This time, don’t close PowerShell as this command is a per-session setting.

      Again run the command:
      [Net.ServicePointManager]::SecurityProtocol

      Does it show you TLS1.2 now? If yes, run the command:
      Install-Module PowershellGet -Force

      I hope that this worked.

  7. Hi Ali – this is brilliant – thank you! perfect solution to the problem I was getting. Excellent bit of troubleshooting and knowledge sharing. Much appreciated!

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top