免責事項:これは英文の記事「PowerCLI commands fail to execute after an offline installation」の日本語訳です。記事はベストエフォートで翻訳を進めているため、ローカライズ化コンテンツは最新情報ではない可能性があります。最新情報は英語版の記事で参照してください。
オフライン環境において、Connect-VIServer などの PowerCLI コマンドを実行した際に以下のエラーが発生します : 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: ####)
VMware vCenter Server 8.x
VMware PowerCLI
本事象は、 Windows のセキュリティ機能が PowerCLI の DLL ファイルに「Zone.Identifier」属性を適用し、ブロック状態としてマークすることが原因で発生します。
Windows 標準の展開ツール( 右クリック > [すべて展開] )を使用して ZIP ファイルを解凍すると、元の ZIP ファイルに付与されていたブロック属性が、解凍後のすべてのフォルダおよびファイルに継承されます。
この状態では、個別にブロック解除の処理を試行しても不完全な状態となる可能性が高く、PowerShell は「信頼できない外部モジュール」と判定し、当該モジュールのロードを拒否します。
Windows 標準ツールによるセキュリティ属性の継承を避けるため、以下の手順でモジュールを再配置します。