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

January 18, 2023 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

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

October 15, 2023

How to Query and Change Teams User Presence...

October 8, 2023

How to Use Ansible to Manage Windows Machines

September 25, 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

  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023
  • How to Use Ansible to Manage Windows Machines

    September 25, 2023
  • Installing Language Pack in Windows 10/11 with PowerShell

    September 15, 2023
  • Configure Email Forwarding for Mailbox on Exchange Server/Microsoft 365

    September 14, 2023
  • How to View and Change BIOS (UEFI) Settings with PowerShell

    September 13, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Fix: Remote Desktop Licensing Mode is not Configured
  • Manage Windows Updates with PSWindowsUpdate PowerShell Module
  • Configuring Port Forwarding in Windows
  • Start Menu or Taskbar Search Not Working in Windows 10/11
  • How to Install Remote Server Administration Tools (RSAT) on Windows
  • How to Delete Old User Profiles in Windows
  • Get-ADUser: Find Active Directory User Info with PowerShell
Footer Logo

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


Back To Top