Search code examples
powershellpowerbiimport-module

powershell 7 can't install module by install-module command


I installed latest powershell 7 on my laptop windows 10 enterprise; tried to install a module by: install-module MicrosoftPowerBIMgmt but got below error; Any information is much appreciated.

error screenshot

I tried to follow the prompts to install "NuGet provider", but also getting errors.

thanks mklement0 providing the information for install-psresource; But why install-module is not working in my powershell 7? tried to figure this out, is it because I have both powershell 5.1 and powershell 7 installed? see below "get-module -ListAvailable PowerShellGet" output.

enter image description here


Solution

  • I have no explanation for your specific symptom, but per your feedback using
    Install-PSResource MicrosoftPowerBIMgmt instead of
    Install-Module MicrosoftPowerBIMgmt solved the problem.

    • Install-PSResource, from the PSResourceGet module, is the successor to Install-Module and ships with PowerShell (Core) 7.4+.

      • However, you can install it on demand from the PowerShell Gallery in older versions, including Windows PowerShell, too (e.g., with
        Install-Module Microsoft.PowerShell.PSResourceGet)

      • At some point in the future, Windows itself will ship with this module so that it will be available by default in Windows PowerShell too - see this PowerShell Team blog post for more information.

    • Unlike Install-Module, Install-PSResource is actively maintained, and is worth trying whenever specific Install-Module calls fail.