PowerShell / PowerShellGallery

228 stars 65 forks source link

Unable to run install-module on Windows Server 2019 #108

Open andyfisher100 opened 4 years ago

andyfisher100 commented 4 years ago

Any time i try running the Install Module command i'm currently getting the following errors. I have tried running this on multiple machine and they all give me the same errors

PS C:\Windows\system32> Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Get-PSGalleryApiAvailability : PowerShell Gallery is currently unavailable.  Please try again later.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1711 char:9
+         Get-PSGalleryApiAvailability -Repository $Repository
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-PSGalleryApiAvailability], InvalidOperationException
    + FullyQualifiedErrorId : PowerShellGalleryUnavailable,Get-PSGalleryApiAvailability

Get-PSGalleryApiAvailability : PowerShell Gallery is currently unavailable.  Please try again later.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4437 char:9
+         Get-PSGalleryApiAvailability -Repository $Name
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-PSGalleryApiAvailability], InvalidOperationException
    + FullyQualifiedErrorId : PowerShellGalleryUnavailable,Get-PSGalleryApiAvailability

PackageManagement\Get-PackageSource : Unable to find repository 'PSGallery'. Use Get-PSRepository to see all available repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4451 char:35
+ ... ckageSources = PackageManagement\Get-PackageSource @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...etPackageSource:GetPackageSource) [Get-PackageSource], Exception
    + FullyQualifiedErrorId : SourceNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageSource

I thought this might have been to do with tls 1.0 no longer being supported but i have disabled it and still get the same issues

bormm commented 3 years ago

Your PowerShellGet is superold! I would first update: Install-PackageProvider -Name NuGet -Force | Out-Null;Install-Module PackageManagement -Force;Install-Module PowerShellGet -Force

mloskot commented 3 years ago

I confirm getting the latest via iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI" fixes the issue.

deadcert commented 1 year ago

I confirm getting the latest via iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI" fixes the issue. @mloskot can we do this command in uninteractive mode? I tried doing it through -Argument List '/quiet' but that's not working

mloskot commented 1 year ago

@deadcert 🤷‍♂️