Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find module providers (PowerShellGet). #183

Closed
murcury opened this issue May 27, 2016 · 19 comments
Closed

Unable to find module providers (PowerShellGet). #183

murcury opened this issue May 27, 2016 · 19 comments

Comments

@murcury
Copy link

murcury commented May 27, 2016

System Info:

PS C:\WINDOWS\system32> [environment]::OSVersion.Version
Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      10586  0
PS C:\WINDOWS\system32> $PSVersionTable.PSVersion
Major  Minor  Build  Revision
-----  -----  -----  --------
5      0      10586  122

Error:

PS C:\WINDOWS\system32> Get-PSRepository
PackageManagement\Get-PackageSource : Unable to find module providers (PowerShellGet).
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:3544 char:31
+ ... ckageSources = PackageManagement\Get-PackageSource @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Power...etPackageSource:GetPackageSource) [Get-PackageSource
   ], Exception
    + FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageSource

The below returns nothing:

PS C:\WINDOWS\system32> Get-PackageProvider -ListAvailable
PS C:\WINDOWS\system32>
@murcury
Copy link
Author

murcury commented May 27, 2016

Looks like I solved the issue. I installed Chocolatey by using the CMD.exe method.

I ran CMD.exe as an administrator and ran the following command:

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

Now I have a PS Repository: PS C:\WINDOWS\system32> Get-PSRepository

Name                      PackageManagementProvider InstallationPolicy   SourceLocation
----                      ------------------------- ------------------   --------------
PSGallery                 NuGet                     Untrusted            https://www.powershellgallery.com/api/v2/

I'm guessing something during the install of Chocolatey, repaired whatever was broken.

@murcury murcury closed this as completed May 27, 2016
@dermeister0
Copy link

dermeister0 commented Jan 12, 2017

I got the same issue for on clean Windows Server 2016 virtual machine. Probably it happened when network was not available.

Get-PSRepository
WARNING: Unable to find module repositories.

Execute the command to fix (solution from http://www.classcastexception.com/2016/04/install-container-support-on-windows.html):

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Verbose -Force

Then restart PowerShell.

Chocolatey installation should help too.

@msvaillant
Copy link

I have no luck with this problem

PS C:\Windows\system32> Get-PSRepository
WARNING: Unable to find module repositories.
PS C:\Windows\system32> [environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      14393  0
PS C:\Windows\system32> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14393  693
PS C:\Windows\system32> Get-PackageProvider -ListAvailable

Name                     Version          DynamicOptions
----                     -------          --------------
Chocolatey               2.8.5.130        SkipDependencies, ContinueOnFailure, ExcludeVersion, ForceX86, PackageSave...
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.208        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag...
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, ...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

I tried

PS C:\Windows\system32> Register-PSRepository -Default -Verbose
VERBOSE: Performing the operation "Register Module Repository." on target "Module Repository 'PSGallery' () in provider 'PowerShellGet'.".
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force

but get-psrepository stays empty - can you help me with this strange situation?

@dermeister0
Copy link

Try following command:

Register-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2/ -PackageManagementProvider NuGet -PublishLocation https://www.powershellgallery.com/api/v2/package/ -ScriptSourceLocation https://www.powershellgallery.com/api/v2/items/psscript/ -ScriptPublishLocation https://www.powershellgallery.com/api/v2/package/

@msvaillant
Copy link

@dermeister0

PS C:\Windows\system32> Register-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2/
-PackageManagementProvider NuGet -PublishLocation https://www.powershellgallery.com/api/v2/package/ -ScriptSourceLocatio
n https://www.powershellgallery.com/api/v2/items/psscript/ -ScriptPublishLocation https://www.powershellgallery.com/api/
v2/package/
Register-PSRepository : Use 'Register-PSRepository -Default' to register the PSGallery repository.
At line:1 char:1
+ Register-PSRepository -Name PSGallery -SourceLocation https://www.pow ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (PSGallery:String) [Register-PSRepository], ArgumentException
    + FullyQualifiedErrorId : UseDefaultParameterSetOnRegisterPSRepository,Register-PSRepository

@samkh79
Copy link

samkh79 commented Jul 18, 2017

@msvalliant did you find and solution to your problem above? I am coming across the exact same error.

@msvaillant
Copy link

@samkh79 I have contacted network admins to help me solve this problem, and they did it somehow. As I understand it is problem with whitelist/blacklist of host in firewall settings

@efav
Copy link

efav commented Jul 31, 2017

@msvaillant Thank you for the post. It saves me a ton of time. I'll abandon trying to use the psgallery from work.

@nbuuck
Copy link

nbuuck commented Aug 4, 2017

I began encountering problems with executing Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Verbose -Force after SSL/TLS hardening was applied to the server where the command was executing. I had to revert the protocol and ciphers (HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL) and cipher suite (HKLM\SYSTEM\CurrentControlSet\Control\Cryptography) preferences to default values in order for Install-PackageProvider and the underlying libraries to be able to connect to www.powershellgallery.com.

Before SSL/TLS hardening was backed out, I saw Event ID 36871 in the System log each time I tried to install the NuGet provider. The event text was:

A fatal error occurred while creating a TLS client credential. The internal error state is 10013.

Edit: Further investigation has revealed that the client library being used to fetch repo data is only capable of TLS 1.0, while the host invoking Install-Module was configured to only use TLS 1.2.

@decmaxn
Copy link

decmaxn commented Aug 7, 2017

I am getting the same problem on a Windows Server 2016 version 1607 Build 14393.447 installation with GUI, but it's not happening on the installation without GUI. $PSVersionTable return exactly same version on both installation.

@samkh79
Copy link

samkh79 commented Aug 7, 2017

I also have the network team enable internet access temporarily on the servers to make it to work.

@MHimken
Copy link

MHimken commented Nov 25, 2017

@nbuuck

Edit: Further investigation has revealed that the client library being used to fetch repo data is only capable of TLS 1.0, while the host invoking Install-Module was configured to only use TLS 1.2.

This is on spot - thanks a lot

@ghost
Copy link

ghost commented Nov 14, 2018

Register-PSRepository -Default

then

Get-PSRepository

Name InstallationPolicy SourceLocation

PSGallery Untrusted https://www.powershellgallery.com/api/v2

@nathanmcnulty
Copy link

For those who have performed protocol/cipher suite hardening, you can use this on a per-session basis to tell the client to use TLS 1.2 instead:

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

Just run that right before your Get-PSRepository or Install-Module ;)

@JrEach25
Copy link

What worked for me was to disable FIPS in regedit and reboot. Then run [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12. Finally, run Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force.

@ChrisKapend
Copy link

What worked for me was to disable FIPS in regedit and reboot. Then run [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12. Finally, run Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force.

Hey @JrEach25 don't know if you'll ever read this but you saved me !!! spend about two hours trying to get this sorted, I'm not sure if the issue is related to windows virtual machines ? or some update ?

@alerickson
Copy link
Collaborator

alerickson commented Jun 4, 2020

Hi @ChrisKapend are you still having this issue with the latest version of PackageManagement? If so what command are you running?

@ChrisKapend
Copy link

Hi @ChrisKapend are you still having this issue with the latest version of PackageManagement? If so what command are you running?

Hi @alerickson thanks for reaching out, after updating NuGet version 3.0.0.1 the error disappears

@rdoloto
Copy link

rdoloto commented Feb 16, 2021

I know this is bit old but you need to set following Enable-TlsCipherSuite -Name "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" -Position 0 if you are restricting ciphers in enviorment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests