PowerShell/PowerShellGetv2

Error: Unable to find module providers (PowerShellGet)

danpousson opened this issue · 10 comments

Steps to reproduce

when running: update-module powershellget
error: Update-Module: Module 'powershellget' was not installed by using Install-Module, so it cannot be updated.


when running: get-psrepository
Error: Unable to find module providers (PowerShellGet)

steps to resolve:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted;
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;

Environment data

Windows Server OS 2016

> $PSVersionTable
5.1 & 7.1.3
> Get-Module -ListAvailable PowerShellGet,PackageManagement
results:
Directory: C:\program files\powershell\7\Modules
Script     1.4.7                 PackageManagement         
Script     2.2.5                 PowerShellGet

Directory: C:\Program Files\WindowsPowerShell\Modules
Script     1.4.7                 PackageManagement
Binary     1.0.0.1               PackageManagement 
Script     2.2.5                 PowerShellGet
Script     1.0.0.1               PowerShellGet
> Get-PackageProvider -ListAvailable
results
NuGet                    3.0.0.1

contact info:
Dan Pousson
danpousson@gmail.com

Existing modules:

<style> </style>
Module Version Name
Script 10.0.1.34 ActPowerCLI
Script 6.1.0 Az
Script 1.1.0 Az
Script 2.4.0 Az.Accounts
Script 1.2.0 Az.Accounts
Script 1.1.1 Az.Advisor
Script 2.1.1 Az.Aks
Script 1.0.0 Az.Aks
Script 1.1.4 Az.AnalysisServices
Script 1.0.0 Az.AnalysisServices
Script 2.2.0 Az.ApiManagement
Script 1.0.0 Az.ApiManagement
Script 1.0.0 Az.AppConfiguration
Script 1.1.1 Az.ApplicationInsights
Script 1.0.0 Az.ApplicationInsights
Script 1.7.0 Az.Automation
Script 1.0.0 Az.Automation
Script 3.1.0 Az.Batch
Script 1.0.0 Az.Batch
Script 2.0.0 Az.Billing
Script 1.0.0 Az.Billing
Script 1.7.1 Az.Cdn
Script 1.0.0 Az.Cdn
Script 1.8.0 Az.CognitiveServices
Script 1.0.0 Az.CognitiveServices
Script 4.14.0 Az.Compute
Script 1.1.0 Az.Compute
Script 2.1.0 Az.ContainerInstance
Script 1.0.0 Az.ContainerInstance
Script 2.2.3 Az.ContainerRegistry
Script 1.0.0 Az.ContainerRegistry
Script 1.2.0 Az.CosmosDB
Script 1.1.0 Az.DataBoxEdge
Script 1.1.0 Az.Databricks
Script 1.12.1 Az.DataFactory
Script 1.0.0 Az.DataFactory
Script 1.0.2 Az.DataLakeAnalytics
Script 1.0.0 Az.DataLakeAnalytics
Script 1.3.0 Az.DataLakeStore
Script 1.0.1 Az.DataLakeStore
Script 1.0.0 Az.DataShare
Script 1.1.0 Az.DeploymentManager
Script 3.0.0 Az.DesktopVirtualization
Script 1.0.2 Az.DevTestLabs
Script 1.0.0 Az.DevTestLabs
Script 1.1.2 Az.Dns
Script 1.0.0 Az.Dns
Script 1.3.0 Az.EventGrid
Script 1.1.0 Az.EventGrid
Script 1.8.0 Az.EventHub
Script 1.0.0 Az.EventHub
Script 1.8.0 Az.FrontDoor
Script 3.0.0 Az.Functions
Script 4.3.0 Az.HDInsight
Script 1.0.0 Az.HDInsight
Script 1.3.1 Az.HealthcareApis
Script 2.7.3 Az.IotHub
Script 1.0.1 Az.IotHub
Script 3.4.5 Az.KeyVault
Script 1.0.0 Az.KeyVault
Script 2.0.0 Az.Kusto
Script 1.5.0 Az.LogicApp
Script 1.1.0 Az.LogicApp
Script 1.1.3 Az.MachineLearning
Script 1.0.0 Az.MachineLearning
Script 1.1.1 Az.Maintenance
Script 2.0.0 Az.ManagedServices
Script 1.0.2 Az.MarketplaceOrdering
Script 1.0.0 Az.MarketplaceOrdering
Script 1.1.1 Az.Media
Script 1.0.0 Az.Media
Script 1.0.2 Az.Migrate
Script 2.5.0 Az.Monitor
Script 1.0.0 Az.Monitor
Script 4.9.0 Az.Network
Script 1.0.0 Az.Network
Script 1.1.1 Az.NotificationHubs
Script 1.0.0 Az.NotificationHubs
Script 2.3.0 Az.OperationalInsights
Script 1.0.0 Az.OperationalInsights
Script 1.4.1 Az.PolicyInsights
Script 1.0.0 Az.PolicyInsights
Script 1.1.2 Az.PowerBIEmbedded
Script 1.0.0 Az.PowerBIEmbedded
Script 1.0.3 Az.PrivateDns
Script 4.2.0 Az.RecoveryServices
Script 1.0.0 Az.RecoveryServices
Script 1.4.0 Az.RedisCache
Script 1.0.0 Az.RedisCache
Script 1.0.0 Az.RedisEnterpriseCache
Script 1.0.3 Az.Relay
Script 1.0.0 Az.Relay
Script 1.0.0 Az.ResourceMover
Script 4.2.0 Az.Resources
Script 1.1.0 Az.Resources
Script 1.0.0 Az.SecurityInsights
Script 1.5.0 Az.ServiceBus
Script 1.0.0 Az.ServiceBus
Script 3.0.0 Az.ServiceFabric
Script 1.0.0 Az.ServiceFabric
Script 1.3.0 Az.SignalR
Script 1.0.1 Az.SignalR
Script 3.2.0 Az.Sql
Script 1.0.1 Az.Sql
Script 1.1.0 Az.SqlVirtualMachine
Script 3.8.0 Az.Storage
Script 1.0.1 Az.Storage
Script 1.5.0 Az.StorageSync
Script 2.0.0 Az.StreamAnalytics
Script 1.0.0 Az.StreamAnalytics
Script 1.0.0 Az.Support
Script 1.0.4 Az.TrafficManager
Script 1.0.0 Az.TrafficManager
Script 2.7.0 Az.Websites
Script 1.0.1 Az.Websites
Binary 0.0.0.0 bcp
Binary 0.0.0.0 Bogus
Manifest 7.0.0.0 CimCmdlets
Script 1.1.15 dbatools
Script 1.1.2 dbatools
Script 1.1.15 dbatools
Script 1.1.2 dbatools
Script 1.0.87 dbatools
Script 1.0.30 dbatools
Script 1.0.29 dbatools
Script 1.0.27 dbatools
Script 0.9.782 dbatools
Script 0.9.771 dbatools
Manifest 1 Defender
Script 7.1.2 ImportExcel
Manifest 1.2.5 Microsoft.PowerShell.Archive
Manifest 7.0.0.0 Microsoft.PowerShell.Diagnostics
Manifest 7.0.0.0 Microsoft.PowerShell.Host
Manifest 7.0.0.0 Microsoft.PowerShell.Management
Script 1.0.1 Microsoft.PowerShell.Operation.Validation
Manifest 7.0.0.0 Microsoft.PowerShell.Security
Manifest 7.0.0.0 Microsoft.PowerShell.Utility
Manifest 7.0.0.0 Microsoft.WSMan.Management
Binary 1.0.0.1 PackageManagement
Script 1.4.7 PackageManagement
Script 1.4.7 PackageManagement
Script 3.4.0 Pester
Script 2.2.5 PowerShellGet
Script 2.2.5 PowerShellGet
Script 1.0.0.1 PowerShellGet
Script 2.0.5 PSDesiredStateConfiguration
Script 7.0.0.0 PSDiagnostics
Script 2.1.0 PSReadLine
Script 1.2 PSReadline
Binary 2.2.0.2 PSWindowsUpdate
Binary 2.1.1.2 PSWindowsUpdate
Binary 0.0.0.0 sqlcmd
Manifest 14 SQLPS
Script 21.1.18147 SqlServer
Script 21.1.18080 SqlServer
Manifest 13.1.0.0 SqlServerDsc
Binary 2.0.3 ThreadJob
Script 1 VdpHelper
Script 1 VdpHelper
Manifest 2.25.0.0 xActiveDirectory
Script 8.6.0.0 xPSDesiredStateConfiguration

Thanks @danpousson! Is this still an issue for you or have you been able to find a work around?

Hi, yes this is still an issue.

@danpousson just to clarify did the steps you included in

steps to resolve: Set-ExecutionPolicy -ExecutionPolicy Unrestricted; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;

Was this what you tried to do to resolve it but had no luck?

Based on the error message, the module might not have been installed using PowerShellGet, can you try the following commands

Install-module PowerShellGet -Force -AllowClobber

and then try again?

@StevenBucher98
Yes correct.

here are the results of Install-module PowerShellGet -Force -AllowClobber:

Unable to find module providers (PowerShellGet)

PS C:\> Install-module PowerShellGet -Force -AllowClobber

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\program files\powershell\7\Modules\PackageManagement\PackageManagement.format.ps1xml?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): r

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\program files\powershell\7\Modules\PackageManagement\PackageManagement.psm1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): r

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\program files\powershell\7\Modules\PackageManagement\PackageManagement.format.ps1xml?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): r
Install-Package: C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:9711
Line |
9711 |  … talledPackages = PackageManagement\Install-Package @PSBoundParameters
     |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to find module providers (PowerShellGet).```

When running PowerShell-7.1.4-win-x64.msi I get this error above in the screenshot.

This may have led me into this strange scenario that I am in.
I think the PS 7 modules a physically in place but not properly installed.

That above error happens the same with install or uninstall

Thanks @danpousson, I outline some steps for manually installing PowerShellGet and Packagement management in this issue here: https://github.com/PowerShell/PowerShellGet/issues/488#issuecomment-926102857

Give this a try and let us know if it works, if it does not work can you include the output of Install-module PowerShellGet -Force -AllowClobber -Verbose?

That worked thank you so much!