I was running a command to install a PowerShell module, e.g.
Install-Module -Name navcontainerhelper -Force
while I received the following error message:
Unable to resolve package source ‘https://www.powershellgallery.com/api/v2’
Solution:
Run PowerShell as Administrator and run the following command to force to use TLS1.2 protocol
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Did my solution solve your problem? Leave a reply.
89 replies on “Unable to resolve package source ‘https://www.powershellgallery.com/api/v2’”
This was exactly what I needed, thanks so much!!! The answer was so straightforward I wasn’t really sure this has much “substance” (no offense intended) but the solution really was that precise and effective, so thank you very much for posting this!! Cheers
Hi Chris,
I’m happy that I was able to help you through my website. Yes, my goal is to provide a working solution to the error messages I received in my daily experience working in IT.
Your message is really appreciated because give me the motivation to continue writiing new posts.
Thank you
Thank you very much!! It solved my problem which I was struggling with for a whole day.
You the man! Resolved my issue. Thanks for posting.
+1
Perfect. Thanks.
Worked as a charm thanks
Many thanks. Worked a treat!
Not solve for me.
I receive the erro when execute the command ” invoke-command -ComputerName $computer -ScriptBlock {install-module pswindowsupdate -force}” and setting the $computer to the local hostname, but if i run “install-module pswindowsupdate -force” directly I dont receive the error.
I do not understand why you are using ScriptBlock if you want install a module in the same pc/server?
Worked like a charm 🙂
Thank you !!
Perfect solution! Thats solved my problem. Thank you very much!
Thank you so much for sharing! How long did it take you to come up with this solution?
Hi,
Actually I had an issue with an integration in NAV that suddenly stopped working and the solution was to enable use TLS 1.2
I applied the same solution here and it worked.
Thank you, vey much!
This was my case:
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
PS C:\Windows\system32> Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClo
bber
WARNING: Unable to resolve package source ‘https://www.powershellgallery.com/api/v2’.
PackageManagement\Install-Package : No match was found for the specified search criteria and module name
‘PackageManagement’. Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21
+ … $null = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power….InstallPackage:InstallPackage) [Install-Package], Ex
ception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
PS C:\Windows\system32> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
PS C:\Windows\system32> Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClo
bber
PS C:\Windows\system32>
Thank you so much – have searched for a solution for hours!
Great!!! It Works
Thanx, solved
Definitely solved, thank you!
It certainly did resolve the issue for me.
Perfect! Thanks so much.
I have same issue here and your command solved my problem.
Thanks
Aiman Farouk
Yes! Thank You
Worked for me! Would love to hear how you arrived at the answer.
Thank you so much , it worked for me
Yes! This fixed my problem. Thank you so much
I was searching for solution for months now. and can’t beleive it worked just fine!
Fixed it right away. Great Job
Yes, thank you!
Yes, thanks. I think the last (several) time I fixed this problem it required me manually downloading the package manager and psget modules to install locally (rather than upgrade.)
Yeah that helped, thanks a lot! Andy
Thank you!
Fantastic. Have been dealing with this problem for months and your one-liner solved it. Thanks so much!
Many, many thanks for the great solution !
Thank you very much, this is very helpful.. But I noticed the authentication prompt doesn’t come with all clients, Mobile client fine, Apple devices fine, but windows 10 sometime it gives the authentication prompt sometime it doesn’t.. Is there an additional settings that need to be done on the Access Point Itself..?
Much appreciated your help and support.
Regards
Thanks i wasn’t able to install any module from the gallery , this resolved my issue.
This worked for me but for some reason now I have bloody diarrhea?
Yes it did, thanks mate
Thanks mate, it solved my problem and save me a lot of time.
Looked everywhere. but this solution worked. Thank you
It really resolved my issue too. Thanks a lot!
It worked. Thanks a ton!
This works but only for the session. A permanent solution is to run the following in a admin PS session then restart PS.
# set strong cryptography on 64 bit .Net Framework (version 4 and above)
Set-ItemProperty -Path ‘HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319’ -Name ‘SchUseStrongCrypto’ -Value ‘1’ -Type DWord
# set strong cryptography on 32 bit .Net Framework (version 4 and above)
Set-ItemProperty -Path ‘HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319’ -Name ‘SchUseStrongCrypto’ -Value ‘1’ -Type DWord
I used the SchUseStrongCrypto solution to get past the error: Unable to download from URI ‘https://go.microsoft.com/fwlink/?…
After a system restart, I then got the error: Unable to resolve package source ‘https://www.powershellgallery.com/api/v2’
I tried the [Net.ServicePointManager]::SecurityProtocol = … solution posted here. but after entering :
Install-Module PowershellGet -Force , I got the same error!
In desperation I entered Install-Module PowershellGet -Force -AllowClobber
and it worked!
Thank you so much you saved the day!
This resolved the error I was getting, thank you!
You bloody hero Sir!
thanks, this did the trick!
THANK YOU! WORKED PERFECTLY!!
You are a genius! Thank you very much
Thanks for much! I found this after hours of research
Thanks for the solution. Worked perfectly.
Golden! Thank you so much for this, and also – thanks previous commenters for pushing this to the top of Google results for my query.. 🙂
I wonder if the culprit is me (@work) still being on Win7?
Thanks! this worked perfectly
Thanks for the solution!
worked perfect, Thank You!
Worked perfectly- thanks
How refreshing to encounter a concise description and accurate answer to the problem. I didn’t have to watch a 5-minute video, nor read about how you forgot to feed your cat because you were working so diligently to figure out the problem. Thanks for sharing your expertise.
it did solve two problems and i should have known. 🙂 first i could not send mail via SSL and sendgrid.
thought it was the code i had written, so tried to download a module. got the error. fixed it and presto. So, thanks!!
Thanks a lot for the simple and to the point solution @Eclipses!
And funny to encounter a former colleague struggling with the same problem 🙂
Greetings,
Gaspar
Worked for me. Thank you !!
Thanks, it’s solved the problem. Super!
Spot on!
Thank you very much, fixed the same problem on my machine.
Did not work for me.
HI, https://www.powershellgallery.com/api/v2 is down since this afternoon. Unfortunately I cannot make miracles
Thanks for the response. I didn’t know it was down, I guess bad timing on my part. Oh well, I’ll try another day.
Unfortunately unlike day, all my DevOps pipelines started failing suddenly.
Thank you from me also! Finally found your page on the interweb.
Awesome it worked.
yes,you are awesome
Thanks!
Thank you. Problem solved!
Thank you this resolved my issue as well
This was exactly what I needed.
This helped! Thanks a lot
This has been working until recently – suddenly the problem is back, despite settings
The specified Uri ‘https://www.powershellgallery.com/api/v2/’ for parameter ‘SourceLocation’ is an invalid Web Uri.
PS C:\WINDOWS\system32> [Net.ServicePointManager]::SecurityProtocol
Tls12
Registry keys also set.
Any suggestion welcome.
I can access the psgallery from a web browser but not doing web-request from powershell
Finally found the solution powershell gallery user Digicert Global Root G2 now,
Adding this certificat to Thruste root certificats solved the problem.
Thank you for your valuable contribution, I’m sure this information will help others as well.
How easy 😀 Thank you
Worked for me. Thanks!
thanks for the hint
Bravo men, it just worked out thanks men
Many thanks!
You should indicate this is a single line of code. Thanks!
Hi! yes, that worked OK.
Thank you,
Thats great!
Thank you.
Great.. Thank you