Powershell modules are not being installed to the correct folder

I’m trying to install a module called vmware.PowerCLI

So I execute in powershell (admin):
install-module vmware.PowerCLI

Powershell then proceeds to install this module and a bunch of related modules. I can see the installation of all these modules flashing by on the screen, and eventually powershell will return a “complete” without any error. Yet, when I go to C:\Program Files\WindowsPowerShell\Modules to check, I don’t see the vmware.PowerCLI module installed; but I do see some (not all) dependency modules installed.

I’m baffled as this happens to two Win10 computer. But then on another Win10 computer, vmware.PowerCLI was installed successfully along with all dependent modules. What is baffling is that so far, except for vmware.PowerCLI, I’m able to install other modules (eg, Azure, MSOnline) just fine.

So what could be causing this?

Here’s my environment:
Name Value


PSVersion 5.1.18362.145
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
BuildVersion 10.0.18362.145
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

To see what modules you have installed run:

Get-Module -list vmware* | Select-Object Name,Path

This shows you where it was installed. Also, read the documentation for Install-Module: https://docs.microsoft.com/en-us/powershell/module/powershellget/install-module?view=powershell-5.1

By default, Install-Module installs into the CurrentUser scope. You have to use the Scope parameter to override that behavior.

-Scope
<p style="padding-left: 40px;">Specifies the installation scope of the module. The acceptable values for this parameter are AllUsers and CurrentUser.</p> <p style="padding-left: 40px;">The AllUsers scope installs modules in a location that is accessible to all users of the computer:</p> <p style="padding-left: 40px;">$env:ProgramFiles\WindowsPowerShell\Modules</p> <p style="padding-left: 40px;">The CurrentUser installs modules in a location that is accessible only to the current user of the computer:</p> <p style="padding-left: 40px;">$home\Documents\WindowsPowerShell\Modules</p>

Hi, this is OP, hmm my original login has issues. Logged in but then I can’t browse any posts!. Tried it on both Chrome and Firefox and same error result.
Error was “What???”. Very strange.

 

Hi Sean,

Thank you for the tips. I was using shell with admin privilege, and according to the link you posted, the scope should be for AllUsers. Furthermore, like I stated in my post, some of the modules got installed into C:\Program Files\WindowsPowerShell\Modules.
However, when I checked “home\Documents\WindowsPowerShell\Modules”, there was no modules installed at all.

So, what I did was install the vmware.powerCLI module and all depedent modules manually, and put them all into the folder C:\Program Files\WindowsPowerShell\Modules, and now Powershell can see all the *vmware commands. Very strange behavior that I would have to do this, but it works.

reference for manual installation:
https://docs.microsoft.com/en-us/powershell/scripting/gallery/how-to/working-with-packages/manual-download?view=powershell-6