Error encountered when connecting to vCenter through PowerCLI after installing all the modules.
search cancel

Error encountered when connecting to vCenter through PowerCLI after installing all the modules.

book

Article ID: 414827

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

An error was encountered when attempting to connect to the vCenter through PowerCLI after installing the PowerCLI modules.
Connect-VIServer : Could not load module

Environment

vSphere 8.0.x

Cause

  • PowerCLI module will not load correctly.
  • According to the documentation, PowerCLI modules must be unblocked before use. It appears the modules were not properly unblocked, leading to the issue.

Resolution

  • Verify that the PowerCLI modules are extracted and placed in a folder included in the PowerShell module path ($env:PSModulePath).
  • Move the extracted module files to another folder containing PowerShell modules and unblock the files using the following command:
    cd <path_to_powershell_modules_folder> Get-ChildItem * -Recurse | Unblock-File
  • Post making the above changes, should be able to connect to the vCenter server using PowerCLI.