I face this issue on my client computer when I try to run Find-Module PSWindowsUpdate

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 ‘PSWindowsUpdate’. Try Get-PSRepository to see all available registered module
repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1360 char:3
+ PackageManagement\Find-Package @PSBoundParameters | Microsoft …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power…ets.FindPackage:FindPackage) [Find-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage

Even though everything seems to be OK and I am not using any kind of proxy and confirmed all the firewall ports are open as required when I run the Get-PSRepository I got a valid response and the SourceLocation and all seems OK

I used Wireshark to troubleshot the issue and this is what I find and apply the following filter ip.addr == 40.87.85.101 and this is what Wireshark shows.

Wireshark Capture
Wireshark Capture

As I noticed that my client send a Client Hello (the packet before the last one in picture No. 428), but the server sends RST to reset the connection, this is usually a TLS negotiation failure, I click on the packet which sent from my computer No.428 and notices that my Powershell client is requesting to use TLS version 1.0.

Seems strange, even though I am using Windows 10, but anyway, I need to force my Powershell client to use TLS 1.2 at least, so I ran the following command

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

The output from this command is nothing, then simply re-run the Find-Module PSWindowsUpdate

Fixing PowerShell Gallery issue
Fixing PowerShell Gallery issue

Some comments noted that you might need to close the PowerShell window and start it again for this change to take effect, In my case It work straight without having to close anything.

Now everything is working fine 🙂 … Hope you liked this quick post 🙂

There was a post on PowerShell Techcommunity discussing the same issue

Hope this helps, leave me a comment if so. Also why not taking a look at other posts I wrote, I am sure you will find some interseting.

4.9/5 - (19 votes)