PowerShellGallery icon indicating copy to clipboard operation
PowerShellGallery copied to clipboard

PowerShell Gallery is currently unavailable. Please try again later.

Open ghousebaig7in opened this issue 3 years ago • 11 comments

Hi Team,

Currently, getting the below error while running the command 'Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted'.

Get-PSGalleryApiAvailability : PowerShell Gallery is currently unavailable. Please try again later. At C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4264 char:9

  •     Get-PSGalleryApiAvailability -Repository $Name
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [Get-PSGalleryApiAvailability], InvalidOperationException
    • FullyQualifiedErrorId : PowerShellGalleryUnavailable,Get-PSGalleryApiAvailability

Appreciate if someone can give me insights on this issue if it is global.

ghousebaig7in avatar Feb 02 '22 21:02 ghousebaig7in

Hi, are you using TLS version 1.2?
Try running [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 and then running Get-PSGalleryApiAvailability -Repository $Name

for more info see: https://devblogs.microsoft.com/powershell/powershell-gallery-tls-support/

alerickson avatar Feb 02 '22 23:02 alerickson

@alerickson, thanks for your reply. Yes, I did used TLS 1.2 and ran the command that you suggested. But didnt help 😞

ghousebaig7in avatar Feb 03 '22 04:02 ghousebaig7in

Are you still having this issue @ghousebaig7in? If so can you include more details on your PowerShell version?

StevenBucher98 avatar Feb 10 '22 19:02 StevenBucher98

same issue, using TLS 1.2 and powershell 5.1

davesbrown avatar Feb 15 '22 23:02 davesbrown

Having the same issue, a resolution to this seemingly impossible to fix issue would be fantastic. I've been attempting to solve this on and off for weeks, and have tried everything in the book. Anything involving powershellgallery will not work. image

WarmWelcome avatar Sep 29 '22 02:09 WarmWelcome

Hi @WarmWelcome, we can start debugging this by seeing if it's a network issue. Does invoke-webrequest "https://www.powershellgallery.com/api/v2" return a status code of 200?

If you do get a 200, please try the fix suggested in this blog post.

alerickson avatar Oct 10 '22 18:10 alerickson

It gives the error "The underlying connection was closed An unexpected error occurred on a send. At line1 char1" image

WarmWelcome avatar Oct 10 '22 20:10 WarmWelcome

I'm running into the same issue.

trydalch avatar Oct 11 '22 16:10 trydalch

@WarmWelcome given that you are not able to run Invoke-WebRequest successfully, this indicates it may be a network issue instead of connectivity issue. Are you able to access https://www.powershellgallery.com/ via the web browser? There may be a firewall blocking you so just wanted to see if you are able to access the site somehow, even through the browser.

anamnavi avatar Oct 17 '22 18:10 anamnavi

I can access https://www.powershellgallery.com/ via the browser

I get this error using invoke-webrequest

image

and this when trying to install a module

image

Will confirm this machine is in FIPS mode (but I feel I've had this work before in FIPS mode)

blakeduffey avatar Mar 07 '24 19:03 blakeduffey

So I installed PS 7 on this system and tried the following:

invoke-webrequest "https://www.powershellgallery.com/api/v2" -sslprotocol tls12

I now get:
image

blakeduffey avatar Mar 07 '24 20:03 blakeduffey