PowerShell / PowerShellGallery

220 stars 59 forks source link

PowerShell Gallery is currently unavailable. Please try again later. #213

Open ghousebaig7in opened 2 years ago

ghousebaig7in commented 2 years ago

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

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

alerickson commented 2 years ago

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/

ghousebaig7in commented 2 years ago

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

StevenBucher98 commented 2 years ago

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

davesbrown commented 2 years ago

same issue, using TLS 1.2 and powershell 5.1

WarmWelcome commented 1 year ago

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

alerickson commented 1 year ago

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.

WarmWelcome commented 1 year ago

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

trydalch commented 1 year ago

I'm running into the same issue.

anamnavi commented 1 year ago

@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.

blakeduffey commented 4 months ago

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 commented 4 months ago

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