ESXiのCustom Installer作成時のエラー対処①

IntelNUCでESXiを使うには、ESXiのCustom Installerを作成する必要があるのですが、Installer作成時に色々エラーが出て対処に苦しみました。この記事ではエラーの内容とどう対処したかをまとめましたのでご参考ください。いくつかハマりそうなエラーに遭遇したので、エラー毎に記事を分けて記します。

PythonのPath指定が正常にできない!?

事象

Pythonのパス指定ができず、PowerCLIのコマンドを実行しても正常に動作しない。

エラー内容

実際の作業時のログと合わせて記載します。

エラーの前に、まずは下記の通りPythonのPathを設定しました。エラーも出ず環境変数設定からも正常なPath設定がされていることを確認しています。

PS C:\tmp\esxi> Set-PowerCLIConfiguration -PythonPath "C:\Users\User\AppData\Local\Programs\Python\Python311\python.exe"

Perform operation?
Performing operation 'Update VMware.PowerCLI configuration.'?
[Y] はい(Y)  [A] すべて続行(A)  [N] いいえ(N)  [L] すべて無視(L)  [S] 中断(S)  [?] ヘルプ (既定値は "Y"): y

Scope    ProxyPolicy     DefaultVIServerMode InvalidCertificateAction  DisplayDeprecationWarnings WebOperationTimeout
                                                                                                  Seconds
-----    -----------     ------------------- ------------------------  -------------------------- -------------------
Session  UseSystemProxy  Multiple            Unset                     True                       300
User
AllUsers




問題ないと思ってPythonを用いたPowerCLIのコマンドを実行したのですが、以下の通りPathを指定したのにPathを指定しろというエラーがでました。。(Versionは3.7.1以上でした)

PS C:\tmp\esxi> Add-EsxSoftwareDepot ./VMware-ESXi-7.0U3g-20328353-depot.zip
Add-EsxSoftwareDepot : Failed to initialize the VMware.ImageBuilder PowerCLI module because of error: Unknown error.
Make sure that Python 3.7.1 or higher is installed and that you have set the path to the Python executable by using Set
-PowerCLIConfiguration -PythonPath <executable_path>. See the PowerCLI Compatibility Matrixes for information on the Py
thon requirements.
発生場所 行:1 文字:1
+ Add-EsxSoftwareDepot ./VMware-ESXi-7.0U3g-20328353-depot.zip
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-EsxSoftwareDepot], Exception
    + FullyQualifiedErrorId : System.Exception,VMware.ImageBuilder.Commands.AddDepot


PS C:\tmp\esxi> python --version
Python
#バージョン情報についても引けずに”Python”とだけ返ってくる状況です。

以下エラーについて、VMのサイトなど調べても全然情報が出てこなくてハマりそうでした。。なので観点を変えて、PowerShell観点ではなくPython観点で問題ないかを調べました。

Add-EsxSoftwareDepot : Failed to initialize the VMware.ImageBuilder PowerCLI module because of error: Unknown error.

対処

アプリ実行エイリアスのPython関連のエイリアスを無効にする!です。やり方ですが、Windowsで「アプリ実行エイリアス」で検索し、アプリ実行エイリアスを開いてください。中の項目を見ると以下画像のようにPythonが紐づいたエイリアスが2つあり、オンになっています。これをオフにしてからPCを再起動してください。再起動必須です。

結果

以下のように問題なく実行できるようになりました。

PS C:\tmp\esxi> Add-EsxSoftwareDepot .\VMware-ESXi-7.0U3g-20328353-depot.zip

Depot Url
---------
zip:C:\tmp\esxi\VMware-ESXi-7.0U3g-20328353-depot.zip?index.xml

PS C:\WINDOWS\system32> python --version
Python 3.7.9

コメント

タイトルとURLをコピーしました