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>
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.
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]::Tls12Just run that right before your Get-PSRepository or Install-Module 😉
I began encountering problems with executing
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Verbose -Forceafter 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 forInstall-PackageProviderand 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:
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-Modulewas configured to only use TLS 1.2.Hi @alerickson thanks for reaching out, after updating NuGet version 3.0.0.1 the error disappears
@nbuuck
This is on spot - thanks a lot
I got the same issue for on clean Windows Server 2016 virtual machine. Probably it happened when network was not available.
Execute the command to fix (solution from http://www.classcastexception.com/2016/04/install-container-support-on-windows.html):
Then restart PowerShell.
Chocolatey installation should help too.