VMware {code} Community
Paul_Czopowik
Contributor
Contributor
Jump to solution

PowerCLI installs but does not work

I think I've tried just about everything, followed the various forum posts here on resolving this issue but I cannot get PowerCLI to work! I can't believe how difficult this is. I followed instructions on installing and uninstalling but no success. I'm trying this on 3 different Windows 10 systems without success (Windows 10 Enterprise, versions 1709 and 1809). The main issue i'm trying to resolve is:

PS C:\WINDOWS\system32> Install-Module -Name VMware.PowerCLI -Confirm:$false -AllowClobber -Force

PS C:\WINDOWS\system32> Connect-VIServer

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

+ ~~~~~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (Connect-VIServer:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

PS C:\WINDOWS\system32> [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision

-----  -----  -----  --------

10     0      16299  0

PS C:\WINDOWS\system32> $PSVersionTable

Name                           Value

----                           -----

PSVersion                      5.1.16299.785

PSEdition                      Desktop

PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}

BuildVersion                   10.0.16299.785

CLRVersion                     4.0.30319.42000

WSManStackVersion              3.0

PSRemotingProtocolVersion      2.3

SerializationVersion           1.1.0.1

PS C:\WINDOWS\system32>

PS C:\WINDOWS\system32> $env:PSModulePath.Split(';')

C:\Users\pc2550\Documents\WindowsPowerShell\Modules

C:\Program Files\WindowsPowerShell\Modules

C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

PS C:\WINDOWS\system32>

PS C:\WINDOWS\system32> Get-Module -Name VMware* -ListAvailable | Select Name,Version,ModuleBase

Name                                Version         ModuleBase

----                                -------         ----------

VMware.DeployAutomation             6.7.0.11233116  C:\Program Files\WindowsPowerShell\Modules\VMware.DeployAutomati...

VMware.ImageBuilder                 6.7.0.11233116  C:\Program Files\WindowsPowerShell\Modules\VMware.ImageBuilder\6...

VMware.PowerCLI                     11.1.0.11289667 C:\Program Files\WindowsPowerShell\Modules\VMware.PowerCLI\11.1....

VMware.Vim                          6.7.0.10334489  C:\Program Files\WindowsPowerShell\Modules\VMware.Vim\6.7.0.1033...

VMware.VimAutomation.Cis.Core       11.0.0.10335701 C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.Cloud          11.0.0.10379994 C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.Common         11.0.0.10334497 C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.Core           11.0.0.10336080 C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.HorizonView    7.6.0.10230451  C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.License        10.0.0.7893904  C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.Nsxt           11.0.0.10364044 C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.Sdk            11.0.0.10334495 C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.Security       11.0.0.10380515 C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.Srm            11.1.0.11289292 C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.Storage        11.1.0.11273342 C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.StorageUtility 1.3.0.0         C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.Vds            11.0.0.10336077 C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.Vmc            11.0.0.10336076 C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VimAutomation.vROps          10.0.0.7893921  C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation....

VMware.VumAutomation                6.5.1.7862888   C:\Program Files\WindowsPowerShell\Modules\VMware.VumAutomation\...

PS C:\WINDOWS\system32> Get-WmiObject -Class Win32_Product -Filter "name like '%PowerCLI%'" | Select Name,Version

PS C:\WINDOWS\system32>

I verified that the files do exist in the module directories, and verified they're removed during an uninstall, using these commands:

(Get-Module VMware.PowerCLI -ListAvailable).RequiredModules | Uninstall-Module -Force

Get-Module VMware.PowerCLI -ListAvailable | Uninstall-Module -Force

I did this as admin, i tried an older version too. I would not expect this much difficulty from a basic Windows 10 installation where PowerCLI has never been installed.

0 Kudos
1 Solution

Accepted Solutions
Paul_Czopowik
Contributor
Contributor
Jump to solution

Solved by doing this:

https://infiniteloop.io/vmware-powercli-10-setup/

Install-Module -Name VMware.PowerCLI

#accept repo warning and install

#copy over file to fix 64-bit issue

$newDir = "C:\Windows\assembly\GAC_64\log4net\1.2.10.0__692fbea5521e1304"

New-Item $newDir -ItemType directory -Force

$file = gci "C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation.Sdk" | select -last 1 | gci -Recurse -Filter "log4net.dll" | select -first 1

Copy-Item $file.FullName $newDir

#verify log4net.dll has copied over

Get-ChildItem $newDir

#close all instances of VS Code, Powershell ISE, or Powershell console

#Open x64 powershell and run import-module vmware.powercli

For the installation that was for CurrentUser, i just copied the file from that path, also worked.

Why is any of this necessary? One thing i did fail to realize is that I had Visual Studio installed on my workstations that are having problems and patches applied. My test VM that worked was a plain install without any patches.

View solution in original post

3 Replies
Paul_Czopowik
Contributor
Contributor
Jump to solution

I started testing with a fresh VM Windows 10 1809. I followed the article below and was able to get things to work after running

Import-Module vmware.powercli

Welcome PowerCLI to the PowerShell Gallery - Install Process Updates - VMware PowerCLI Blog - VMware...

However on my other workstations i get this:

PS C:\Windows\system32> Import-Module vmware.powercli

Import-Module : Unable to find type [VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory].

At line:1 char:1

+ Import-Module vmware.powercli

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (VMware.VimAutom...eServiceFactory:TypeName) [Import-Module], RuntimeE

   xception

    + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

0 Kudos
Paul_Czopowik
Contributor
Contributor
Jump to solution

Solved by doing this:

https://infiniteloop.io/vmware-powercli-10-setup/

Install-Module -Name VMware.PowerCLI

#accept repo warning and install

#copy over file to fix 64-bit issue

$newDir = "C:\Windows\assembly\GAC_64\log4net\1.2.10.0__692fbea5521e1304"

New-Item $newDir -ItemType directory -Force

$file = gci "C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation.Sdk" | select -last 1 | gci -Recurse -Filter "log4net.dll" | select -first 1

Copy-Item $file.FullName $newDir

#verify log4net.dll has copied over

Get-ChildItem $newDir

#close all instances of VS Code, Powershell ISE, or Powershell console

#Open x64 powershell and run import-module vmware.powercli

For the installation that was for CurrentUser, i just copied the file from that path, also worked.

Why is any of this necessary? One thing i did fail to realize is that I had Visual Studio installed on my workstations that are having problems and patches applied. My test VM that worked was a plain install without any patches.

MDRR73
Contributor
Contributor
Jump to solution

Paul,

Thank you for posting the steps , Issue which i was facing from last one month was resolved.

Thank you once again

Rangaraj

0 Kudos