Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / PowerShell / PowerShell: Unable to Resolve Package Source

December 14, 2022 PowerShellWindows 10Windows Server 2016

PowerShell: Unable to Resolve Package Source

When you try to install PowerShell modules from the online PSGallery, you may see the following error:

Install-Module SqlServer
WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'sqlserver. Try Get-PSRepository to see all available registered module repositories.
NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage

PowerShell Install-Module - Unable to resolve package source

A similar error will appear when installing any PowerShell module using Nuget provider, no matter what it is: Exchange Online Powershell module, AzureAD, VMware PowerCLI, PSWindowsUpdate, SecretManagement, SQLServer, etc. At the same time, you can install any offline PowerShell module manually.

The problem may occur on Windows 10, Windows Server 2016, or previous Windows versions. The reason is that PowerShell tries to use a legacy and insecure TLS 1.0 protocol to connect to the PSGallery repository by default. Since April 2020, the PowerShell Gallery accepts connecting to the NuGet provider using TLS 1.2 only.

If TLS 1.0 and TLS 1.1 are not disabled in Windows, run the command below to use TLS 1.2 in the current PowerShell session:

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

TLS 1.2 is supported in all Windows versions starting from Windows 8 and Windows Server 2012. You can display a list of supported TLS versions in PowerShell:

[enum]::GetNames([Net.SecurityProtocolType])

supported tls version in powershell

In order to enable TLS 1.2 support in Windows 7 SP1/Windows Server 2008 R2, install KB3140245 and the MicrosoftEasyFix51044.msi fix.

If your Windows 7 doesn’t support TLS 1.2, you will see Error 0x800CCC1A — Your server does not support the encryption type you have specified if you trying to connect to any modern email service with Outlook.

Now you can install or update the module from PowerShell Gallery:

psgallery install module with tls 1.2 enabled

Next time you open your PowerShell console, you will have to enable TLS 1.2 protocol again. You can display protocol versions used in PowerShell for connection as follows:

[Net.ServicePointManager]::SecurityProtocol

powershell: show current tls version

To avoid enabling TLS 1.2 each time you open PowerShell, you may change the default TLS version for .NET Framework. To do it, make the following changes to the registry using PowerShell:

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

If your computer is connected to the Internet through a proxy server, make sure that proxy connection is configured in your PowerShell session:

netsh winhttp show proxy

You can import proxy server settings from Windows:

netsh winhttp import proxy source=ie

A similar error when installing PowerShell modules Unable to download from URI is described in the previous article.

0 comment
1
Facebook Twitter Google + Pinterest
previous post
Using Active Directory User Photo as Account Logon Image on Windows
next post
Disable First User Sign-In Animation in Windows 10 and 11

Related Reading

Configuring Event Viewer Log Size on Windows

May 24, 2023

How to Detect Who Changed the File/Folder NTFS...

May 24, 2023

Enable Single Sign-On (SSO) Authentication on RDS Windows...

May 23, 2023

Allow Non-admin Users RDP Access to Windows Server

May 22, 2023

How to Create, Change, and Remove Local Users...

May 17, 2023

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Configuring Event Viewer Log Size on Windows

    May 24, 2023
  • How to Detect Who Changed the File/Folder NTFS Permissions on Windows?

    May 24, 2023
  • Enable Single Sign-On (SSO) Authentication on RDS Windows Server

    May 23, 2023
  • Allow Non-admin Users RDP Access to Windows Server

    May 22, 2023
  • How to Create, Change, and Remove Local Users or Groups with PowerShell?

    May 17, 2023
  • Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows

    May 16, 2023
  • View Success and Failed Local Logon Attempts on Windows

    May 2, 2023
  • Fix: “Something Went Wrong” Error When Installing Teams

    May 2, 2023
  • Querying Windows Event Logs with PowerShell

    May 2, 2023
  • Configure Windows LAPS (Local Administrator Passwords Solution) in AD

    April 25, 2023

Follow us

  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Manage Windows Updates with PSWindowsUpdate PowerShell Module
  • Installing RSAT Administration Tools on Windows 10 and 11
  • Configuring Port Forwarding in Windows
  • Start Menu or Taskbar Search Not Working in Windows 10/11
  • How to Delete Old User Profiles in Windows?
  • Get-ADUser: Find Active Directory User Info with PowerShell
  • Adding Drivers into VMWare ESXi Installation Image
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top