Connect-VIServer failed with "command was found in the module 'VMware.VimAutomation.Core', but the module could not be loaded"
search cancel

Connect-VIServer failed with "command was found in the module 'VMware.VimAutomation.Core', but the module could not be loaded"

book

Article ID: 298674

calendar_today

Updated On:

Products

VMware Tanzu Kubernetes Grid Integrated Edition

Issue/Introduction

PowerCLI is a collection of PowerShell Modules to manage VMware infrastructure. We can leverage it to manage many resources, such as network, storage, VM, guest OS and more. Changed Block Tracking (CBT) is a VMkernel feature that keeps track of the storage blocks of virtual machines as they change over time. However, it is not fully supported In TKGI v1.10, which could cause mount issues of persistent volumes to the worker node with CBT enabled. So we can use PowerCLI do disabe CBT in the worker vm.

After installing PowerCLI in offline mode as per PowerCLI Installation Guide, may hit the following error when connecting vCenter. But it will fail again even through you run "Import-Module VMware.VimAutomation.Core" by following the hints.
Screen-Shot-2018-04-24-at-11.41.49.png


Environment

Product Version: 1.10

Resolution

In order to solve this issue, please pay attention to the following four items.
  1. Extract the downloaded VMware-PowerCLI-xxxx.zip file and copy all of its subfolder to the PowerShell Modules paths. The subfolders look like the following ones.Screen Shot 2021-11-10 at 10.48.21 AM.png
  2. Choose the first folder of PowerShell Module path, for example we shall choose “C:\Users\ecust\Documents\WindowsPowerShell\Modules” as targetScreen Shot 2021-11-10 at 10.51.06 AM.png
  3. Change the execution policy after unblock filesScreen Shot 2021-11-10 at 10.53.19 AM.png
  4. Import modules after changing the execution policyScreen Shot 2021-11-10 at 10.55.37 AM.png