Unable to install PS module getting some issue

Sakura434 1 Reputation point
2024-07-18T07:43:00.18+00:00

PS C:\Windows\system32> install-module azuread

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\user\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
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,501 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Karelpelck 710 Reputation points
    2024-07-18T07:55:17.3766667+00:00

    It sounds like you’re encountering an issue with installing the NuGet provider for PowerShell. Here are the steps to resolve this:

    1. Open PowerShell as Administrator:
      • Right-click on the PowerShell icon and select “Run as Administrator”.
    2. Set the Security Protocol:
      • Run the following command to ensure PowerShell uses TLS 1.2:
             [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
        
    3. Install the NuGet Provider:
      • Run this command to install the NuGet provider:
             Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
        

    These steps should help you get the required NuGet provider installed.

    0 comments No comments

  2. Manu Philip 18,071 Reputation points MVP
    2024-07-18T08:01:02.63+00:00

    Hi,

    If you enable TLS 1.2 on the system, the issue should resolved. You can follow the steps as below:

    1. If you are trying the installation in a 64 bit machine, run the following cmdlet in PowerShell as administrator
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
    

    Use the following cmdlet in 32-bit based machine

    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
    
    1. Restart PowerShell console and try to see the TLS version with the following cmdlet

    [Net.ServicePointManager]::SecurityProtocol

    1. Now install the NuGet provider by Running the command Install-Module PowershellGet -Force
    2. Try again to install the module which fails

    Hope this helps.


    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.