0

I want to install the Powershell Module MicrosoftPowerBIMgmt with below command line:

Install-Module -Name MicrosoftPowerBIMgmt 

However, the script is executed, but it may be limited by my network, the command line has been stuck in downloading the microsoftpowerbimgmt.profile file, and the progress is 0.

It seems that I can't use the command to complete the download. So I wonder if there is any other scheme to install this module?

Any advice is greatly appreciated.

By the way, my system is windows 10.

Joy
  • 1,171
  • 9
  • 15

1 Answers1

1

I decided to run the install you gave and checking the docs it shows that one of the commands is Get-PowerBIWorkspace. With that in mind, I decided to try this trick:

(Get-Command Get-PowerBIWorkspace).dll

Which gave this result:

C:\Program Files\WindowsPowerShell\Modules\MicrosoftPowerBIMgmt.Workspaces\1.2.1093\lib\netstandard2.0\Microsoft.PowerBI.Commands.Workspaces.dll

This told me to look in C:\Program Files\WindowsPowerShell\Modules\ for the module. Checking that location, I found the following folders were added:

09/17/2022  08:52 PM    <DIR>          MicrosoftPowerBIMgmt.Profile
09/17/2022  08:52 PM    <DIR>          MicrosoftPowerBIMgmt.Admin
09/17/2022  08:53 PM    <DIR>          MicrosoftPowerBIMgmt.Capacities
09/17/2022  08:53 PM    <DIR>          MicrosoftPowerBIMgmt.Data
09/17/2022  08:53 PM    <DIR>          MicrosoftPowerBIMgmt.Reports
09/17/2022  08:53 PM    <DIR>          MicrosoftPowerBIMgmt.Workspaces
09/17/2022  08:53 PM    <DIR>          MicrosoftPowerBIMgmt

Checking the folders show that the data is around 50 MB. Modules are usually entirely contained in the module folder with no external changes made to the system (such as registry changes, or other files placed elsewhere). Since this is Microsoft, that might not be the case.

If I was in your shoes, I would probably use xcopy, or use a copy method you are familiar with, to copy these folders to the module folder on the system where you want the MicrosoftPowerBIMgmt module installed.

If these folders truly contain everything that makes the modules work, and you copy them to the module folder that is normally found in $Env:PSModulePath, then you should be able to successfully run your script.

Darin
  • 1,423
  • 1
  • 10
  • 12
  • Thanks for your input, this might be a solution, but unfortunately I can't go and verify it. Because there is no computer that can successfully install the module, I can't complete the xcopy operation. – Joy Sep 19 '22 at 01:47
  • 1
    @Joy, I don't know your situation. Had expected you could find a laptop or something to install the module and copy it to a USB key or network drive. But I'm getting the impression that maybe you have a high security situation. Which make me wonder, what happens if you run `Install-Module -Name MicrosoftPowerBIMgmt -Scope CurrentUser` on the system? – Darin Sep 19 '22 at 02:03
  • 1
    thanks for your quick reply. I don't have a high level of security on my PC, but it seems that because I'm behind google, I can't download what I need from google. My work computer can access google, but the security level of my work computer is so high that even powershell is forbidden. So I can't copy from work pc to my pc. As for the command you provided, I'll need to get home to try it, will let you know the result once I try it – Joy Sep 19 '22 at 02:10
  • Some other thoughts, if it really is a network issue, then maybe there is a way to use Install-Module's `-Proxy` and `-ProxyCredential` switches to connect to a proxy server. Also, looking at the [docs](https://learn.microsoft.com/en-us/powershell/module/powershellget/install-module?view=powershell-5.1), there is a `-Repository` switch to change the repository. Trying `Get-PSRepository` on my system shows my default repository is `PSGallery, Untrusted, https://www.powershellgallery.com/api/v2`. You might check if your default repository is the same. – Darin Sep 19 '22 at 02:31
  • 1
    I resolved it by download the package and all dependencies of it: https://www.powershellgallery.com/packages/MicrosoftPowerBIMgmt/1.2.1093 and unzip them and put them to the folder which you said, it worked. – Joy Sep 23 '22 at 02:07