VMware {code} Community
dbrame
Contributor
Contributor

PowerCLI Module for PowerShell not working

I have installed the powercli module in powershell using "install-module -name vmware.powercli"; Version 10.1.1.8827524 along with all the modules:

Version        Name
-------        ----
6.7.0.8250345  VMware.DeployAutomation
6.7.0.8250345  VMware.ImageBuilder
10.1.1.8827524 VMware.PowerCLI
6.7.0.8343295  VMware.Vim
10.1.0.8377811 VMware.VimAutomation.Cis.Core
10.0.0.7893901 VMware.VimAutomation.Cloud
10.1.0.8342134 VMware.VimAutomation.Common
10.1.0.8344055 VMware.VimAutomation.Core
6.5.4.7567193  VMware.VimAutomation.HA
7.5.0.8827468  VMware.VimAutomation.HorizonView
10.0.0.7893904 VMware.VimAutomation.License
10.1.0.8346947 VMware.VimAutomation.Nsxt
10.0.0.7893924 VMware.VimAutomation.PCloud
10.1.0.8342078 VMware.VimAutomation.Sdk
10.0.0.7893900 VMware.VimAutomation.Srm
10.1.0.8313015 VMware.VimAutomation.Storage
1.2.0.0        VMware.VimAutomation.StorageUtility
10.1.0.8344219 VMware.VimAutomation.Vds
10.0.0.7893902 VMware.VimAutomation.Vmc
10.0.0.7893921 VMware.VimAutomation.vROps
6.5.1.7862888  VMware.VumAutomation

When I try to use connect-viserver i get this error:

PS C:\Users\dbrame> connect-viserver 192.168.11.71
connect-viserver : The 'connect-viserver' command was found in the module 'VMware.VimAutomation.Core', but the module
could not be loaded. For more information, run 'Import-Module VMware.VimAutomation.Core'.
At line:1 char:1
+ connect-viserver 192.168.11.71
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (connect-viserver:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

anyone have an idea of what the issue could be.

This isn't the only command that is not working, but its the main one I need to work. This is on a Windows 10 machine with the latest version of PowerShell. Funny thing is that VMware.PowerCLI module works with PowerShell Core, but not Powershell.

Reply
0 Kudos
4 Replies
dbrame
Contributor
Contributor

I should also note that when I run 'import-module vmware.vimautomation.core' it errors out saying that vmware.vimautomation.sdk.(something else here here that I do not remember).

I import vmware.vimautomation.sdk it seems like it installs, and then vmware.vimautomation.core import seems to work as well. get-module -listavailable  vm* shows all the correct modules. when trying connect-viserver now it shows that its not a recognized command. connect-viserver used to be in powershell-ise but it is not listed anymore.

Reply
0 Kudos
danialkhan
Contributor
Contributor

I am having the same problem when I run Connect-VIServer command and I get the same error as yours.

pastedImage_1.png

I have Already Install the Modules using this command in C:\Modules\:

Install-Module -Name VMware.PowerCLI

When I try to import one of the module where I am getting error:

PS C:\Modules> Import-Module .\VMware.VimAutomation.Core\

This is where I have the Modules:

pastedImage_5.png

For now I am using Powershell 6.1.1 Core from GitHub - PowerShell/PowerShell: PowerShell for every system!  This seems to work fine though without any modules.

Reply
0 Kudos
Paul_Czopowik
Contributor
Contributor

Have you been able to find a solution? I'm having this same problem on a fresh install of windows.

Reply
0 Kudos
MattTreck
Contributor
Contributor

If anyone is still running into this issue, try running "Set-ExecutionPolicy Unrestricted" from an elevated prompt. This should allow the modules to work properly.