PowerCLI commands fail to execute after an offline installation
search cancel

PowerCLI commands fail to execute after an offline installation

book

Article ID: 431298

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

When attempting to run PowerCLI commands such as Connect-VIServer using modules manually placed in an offline environment, the following error occurs:
 
 Connect-VIServer -Server #### -User ####@####
 Connect-VIServer : The 'Connect-VIServer' command was found in module 'VMware.VimAutomation.Core', but this module could not be loaded.
 For more information, run 'Import-Module VMware.VimAutomation.Core'. 
 Import-Module : File or assembly 'file:///C:\Windows\system32\WindowsPowerShell\v1.0\Modules\VMware.Vim\net472\InternalVimService50.Wcf.dll',
 or one of its dependencies could not be loaded. The operation is not supported. (Exception from HRESULT: ####)

Environment

VMware vCenter Server 8.x
VMware PowerCLI

Cause

This issue is caused by the Windows OS security feature that marks the PowerCLI DLL files (e.g., InternalVimService50.Wcf.dll) as "Blocked" by applying the Zone.Identifier attribute.
When the Windows built-in extraction tool ("Right-click > Extract All") is used to unzip the file, the block attribute attached to the original ZIP file is inherited by all extracted folders and files. 
In this state, even if you attempt to unblock files individually, the process may remain incomplete, and PowerShell will continue to reject the module as an "untrusted external module."

Resolution

To avoid the inheritance of security attributes caused by the Windows built-in tool, re-deploy the modules using the  following steps.

  1. Delete the existing PowerCLI module folders.

  2. Extract the original ZIP using a third-party tool (e.g., 7-Zip).

  3. Copy the unblocked folders to the designated PowerShell module path.