Anavem
Languagefr
How to Fix 'Unable to Install NuGet Provider for PowerShell' Error

How to Fix 'Unable to Install NuGet Provider for PowerShell' Error

Resolve NuGet provider installation errors in PowerShell by enabling TLS 1.2, updating PowerShellGet modules, and troubleshooting connection issues that prevent module downloads from PowerShell Gallery.

April 14, 2026 12 min
mediumpowershell 9 steps 12 min

Why Does the NuGet Provider Installation Fail in PowerShell?

The "Unable to Install NuGet Provider for PowerShell" error is one of the most frustrating issues PowerShell administrators encounter when trying to install modules from PowerShell Gallery. This error typically appears when attempting to install popular modules like ExchangeOnlineManagement, AzureAD, or any module that depends on the NuGet package provider.

The root cause usually stems from three main issues: outdated TLS protocol settings that prevent secure connections to PowerShell Gallery, obsolete PackageManagement and PowerShellGet modules that ship with Windows, or conflicts between multiple versions of these core modules. Windows Server 2016 and older systems are particularly susceptible because they don't enable TLS 1.2 by default, which PowerShell Gallery requires for security.

What Makes This Error So Common in Enterprise Environments?

Enterprise environments face additional challenges due to proxy servers, firewall restrictions, and group policies that can interfere with NuGet provider downloads. Many organizations also have strict change control processes that delay system updates, leaving servers running with the original PowerShell modules that shipped with the operating system.

The problem is compounded by Microsoft's decision to include a "bootstrap" version of the NuGet provider (version 2.8.5.208) that often fails to upgrade properly. When administrators try the obvious solution of running Install-PackageProvider -Name NuGet, they often end up in a circular dependency where the command needs NuGet to install NuGet.

This tutorial provides a systematic approach to resolving these issues permanently. You'll learn how to enable proper TLS protocols, update the underlying module infrastructure, and troubleshoot network connectivity problems that prevent successful NuGet provider installation. By the end, you'll have a fully functional PowerShell environment capable of installing any module from PowerShell Gallery.

Implementation Guide

Full Procedure

01

Open PowerShell as Administrator

Start by launching PowerShell with elevated privileges. This is crucial because installing NuGet providers and updating system modules requires administrator access.

Right-click on the Windows Start button and select "Windows PowerShell (Admin)" or "Terminal (Admin)" on Windows 11. If you're using PowerShell 7, search for "PowerShell" in the Start menu, right-click it, and select "Run as administrator".

Verification: Your PowerShell window title should show "Administrator" and the prompt should display your system path with admin privileges.

Warning: Never skip running as administrator when dealing with NuGet provider issues. User-level installations often fail due to permission conflicts with existing system modules.
02

Enable TLS 1.2 Protocol

The most common cause of NuGet provider installation failures is PowerShell using outdated TLS protocols. PowerShell Gallery requires TLS 1.2, but older systems default to TLS 1.0 or 1.1.

Run this command to enable TLS 1.2 for the current session:

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

Verification: Check the current protocol setting:

[Net.ServicePointManager]::SecurityProtocol

You should see "Tls12" in the output. If you see "SystemDefault" or older protocols, the command worked and upgraded your connection security.

Pro tip: To make TLS 1.2 permanent, add the TLS command to your PowerShell profile. Run notepad $PROFILE and add the TLS line to automatically enable it for every session.

This step is particularly important on Windows Server 2016, where TLS 1.2 isn't enabled by default.

03

Check Current Module Versions

Before attempting fixes, identify which versions of PackageManagement and PowerShellGet you're running. Outdated versions are the root cause of most NuGet provider issues.

Check your current module versions:

Get-Module PackageManagement -ListAvailable | Select-Object Name, Version
Get-Module PowerShellGet -ListAvailable | Select-Object Name, Version

Look for multiple versions installed. The problematic combinations are:

  • PackageManagement 1.0.0.1 with PowerShellGet 1.0.0.1
  • Any version with NuGet provider 2.8.5.208 (bootstrap version)
  • Missing or corrupted PackageManagement modules

Also check the NuGet provider status:

Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue

If this returns an error or shows version 2.8.5.208, you need to update your modules.

Verification: Note down the versions you see. PackageManagement should be 1.1.0.0 or newer, and PowerShellGet should be 2.x or newer for optimal functionality.

04

Update PowerShellGet Module

The most effective solution is updating PowerShellGet, which automatically installs the latest NuGet provider. This approach is preferred over manually installing the NuGet provider.

Force install the latest PowerShellGet module:

Install-Module PowerShellGet -Force -AllowClobber

When prompted about installing NuGet provider, type Y and press Enter. The -AllowClobber parameter allows overwriting existing commands, which is necessary when updating core modules.

If you encounter trust issues with the PowerShell Gallery, temporarily set it as trusted:

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module PowerShellGet -Force -AllowClobber
Set-PSRepository -Name PSGallery -InstallationPolicy Untrusted

Verification: After installation completes, close and reopen PowerShell as Administrator, then check the new version:

Get-Module PowerShellGet -ListAvailable | Sort-Object Version -Descending | Select-Object -First 1

You should see version 2.x or newer.

Warning: After updating PowerShellGet, never run Install-PackageProvider -Name NuGet again. This can revert your NuGet provider to the problematic bootstrap version 2.8.5.208.
05

Alternative: Manual PackageManagement Update

If the PowerShellGet update fails, manually update PackageManagement. This method works when network issues or module conflicts prevent the standard update process.

First, try the direct installation approach:

Install-Module PackageManagement -Force -AllowClobber

If this fails, use the manual download method:

  1. Open a web browser and navigate to: https://www.powershellgallery.com/packages/PackageManagement
  2. Click "Manual Download" tab and download the latest .nupkg file
  3. Rename the .nupkg file to .zip and extract it
  4. Copy the contents to: C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.1.0.0

Create the directory structure if it doesn't exist:

$ModulePath = "$env:ProgramFiles\WindowsPowerShell\Modules\PackageManagement\1.1.0.0"
New-Item -Path $ModulePath -ItemType Directory -Force

After manual installation, restart PowerShell as Administrator and verify:

Import-Module PackageManagement -Force
Get-Module PackageManagement

Verification: The version should show 1.1.0.0 or newer. Now try installing PowerShellGet again:

Install-Module PowerShellGet -Force
06

Clean Up Conflicting Module Versions

Multiple versions of PackageManagement and PowerShellGet can cause conflicts. Clean up old versions while preserving the base system modules.

First, identify all installed versions:

Get-Module PackageManagement -ListAvailable | Format-Table Name, Version, ModuleBase
Get-Module PowerShellGet -ListAvailable | Format-Table Name, Version, ModuleBase

Remove problematic versions, but keep version 1.0.0.1 (base system module). Look for versions in these locations:

  • C:\Program Files\WindowsPowerShell\Modules
  • C:\Users\[Username]\Documents\WindowsPowerShell\Modules

Remove conflicting versions manually:

# Remove user-installed old versions (example paths)
Remove-Item "$env:USERPROFILE\Documents\WindowsPowerShell\Modules\PackageManagement\1.0.0.1" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\Documents\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1" -Recurse -Force -ErrorAction SilentlyContinue

Check your module path for any custom locations:

$env:PSModulePath -split ';'

Verification: After cleanup, restart PowerShell and verify only the correct versions remain:

Get-Module PackageManagement, PowerShellGet -ListAvailable | Sort-Object Name, Version
Pro tip: Never delete modules from C:\Windows\System32\WindowsPowerShell\v1.0\Modules. These are core system modules required for PowerShell to function properly.
07

Test NuGet Provider Installation

Now test if the NuGet provider works correctly by attempting to install a common module. This verifies that all components are functioning properly.

Test with a lightweight module first:

Install-Module PSReadLine -Force -AllowClobber

If successful, test with a more complex module like Exchange Online Management:

Install-Module ExchangeOnlineManagement -Force

Check the NuGet provider status:

Get-PackageProvider -Name NuGet

You should see version 2.8.5.201 or newer. The provider should show as "Installed" with no errors.

Verification: List all available package providers to confirm NuGet is properly registered:

Get-PackageProvider -ListAvailable

You should see NuGet, PowerShellGet, and other providers listed without errors.

Common mistake: If you still get NuGet provider errors, restart your PowerShell session completely. Module updates often require a fresh session to take effect properly.
08

Configure for Non-Administrator Users

If you need to install modules for the current user only (without admin privileges), configure the NuGet provider for user scope installations.

For non-admin scenarios, use the CurrentUser scope:

Install-PackageProvider -Name NuGet -Force -Scope CurrentUser
Install-Module PowerShellGet -Force -Scope CurrentUser -AllowClobber

Set PowerShell Gallery as trusted for the current user:

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

Test user-scoped module installation:

Install-Module Az.Accounts -Scope CurrentUser -Force

Verification: Check that modules install to the user profile:

Get-Module Az.Accounts -ListAvailable | Select-Object ModuleBase

The path should show Documents\WindowsPowerShell\Modules or Documents\PowerShell\Modules for user-scoped installations.

Check the user-specific module path:

$env:PSModulePath -split ';' | Where-Object { $_ -like "*$env:USERNAME*" }
Pro tip: User-scoped installations are perfect for development environments or when you don't have admin access. They don't affect system-wide PowerShell configurations.
09

Troubleshoot Persistent Connection Issues

If you're still experiencing connection problems after updating modules, address network-level issues that can prevent NuGet provider downloads.

Test connectivity to PowerShell Gallery:

Test-NetConnection -ComputerName www.powershellgallery.com -Port 443

If behind a corporate firewall or proxy, configure PowerShell to use your proxy settings:

# Set proxy for current session
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
[System.Net.WebRequest]::DefaultWebProxy = $proxy

For persistent proxy issues, configure WinHTTP proxy settings:

netsh winhttp set proxy proxy-server:port

Test DNS resolution for PowerShell Gallery:

Resolve-DnsName www.powershellgallery.com

If using Windows Server 2016, ensure TLS 1.2 is enabled system-wide via registry:

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

Verification: After making registry changes, restart PowerShell and test the TLS protocol:

[Net.ServicePointManager]::SecurityProtocol

You should see Tls12 available in the protocol list.

Warning: Registry changes for TLS require a system restart to take full effect. Plan accordingly in production environments.

Frequently Asked Questions

Why does PowerShell say NuGet provider is required but won't install it?+
This circular dependency occurs because PowerShell needs NuGet to download NuGet, but the bootstrap version (2.8.5.208) often fails due to TLS protocol issues. The solution is enabling TLS 1.2 first with [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12, then updating PowerShellGet which includes a working NuGet provider. Never try to install NuGet provider directly after updating modules.
What's the difference between PackageManagement and PowerShellGet modules?+
PackageManagement is the underlying framework that handles package providers like NuGet, while PowerShellGet is the specific module for interacting with PowerShell Gallery. PackageManagement 1.0.0.1 ships with Windows but lacks modern TLS support. PowerShellGet 2.x includes an updated PackageManagement with proper NuGet provider support. Always update PowerShellGet first, which automatically updates PackageManagement dependencies.
How do I permanently enable TLS 1.2 for PowerShell on Windows Server 2016?+
Windows Server 2016 doesn't enable TLS 1.2 by default. For permanent system-wide enablement, modify registry keys: Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value 1. Also add [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 to your PowerShell profile ($PROFILE) for session-level enablement. Registry changes require a system restart to take full effect.
Can I install NuGet provider without administrator privileges?+
Yes, use the CurrentUser scope: Install-PackageProvider -Name NuGet -Force -Scope CurrentUser, followed by Install-Module PowerShellGet -Force -Scope CurrentUser -AllowClobber. This installs modules to your user profile (~\Documents\WindowsPowerShell\Modules) instead of system directories. User-scoped installations don't require admin rights but only work for the current user account.
What should I do if corporate proxy blocks PowerShell Gallery access?+
Configure PowerShell to use your corporate proxy with [System.Net.WebRequest]::DefaultWebProxy settings and ensure credentials are properly set. Test connectivity with Test-NetConnection -ComputerName www.powershellgallery.com -Port 443. For persistent issues, configure WinHTTP proxy with netsh winhttp set proxy commands. Some organizations require manual module downloads from PowerShell Gallery's 'Manual Download' tab, then manual installation to module directories.

Discussion

Share your thoughts and insights

Sign in to join the discussion