(O+P)ut

アウトプット



(O+P)ut

エンジニアのアウトプット

【PowerCLI】Forceオプションを付与せずにConnect-VIServerを行う

スポンサーリンク

やりたいこと

PowerCLIにてESXiやvCenterに接続する同コマンドで以下の証明書エラーになる場合に

Error: Invalid server certificate. 

WindowsServer側の設定変更で同エラーを回避する

環境情報
  • VMware ESXi 6.7
  • VMware.PowerCLI 12.0

やり方

PowerShellにて以下コマンドを押下する。

PS> Set-PowerCLIConfiguration -InvalidCertificateAction Warn -Scope AllUsers

それによって以下コマンドでFalseを付与せずにサーバに接続できます。

Connect-VIServer -Server xx -User root -Password xx
...
Name                           Port  User
----                           ----  ----
xx                  443   root

以下、補足です。

補足

以下コマンドで値が取得できますが以下が変更前。

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

以下が変更コマンド。変更実施可否を選択すればUnsetがWarnに変更が入ります。

PS> Set-PowerCLIConfiguration -InvalidCertificateAction Warn -Scope AllUsers
Perform operation?
Performing operation 'Update PowerCLI configuration.'?
[Y] はい(Y)  [A] すべて続行(A)  [N] いいえ(N)  [L] すべて無視(L)  [S] 中断(S)  [?] ヘルプ (既定値は "Y"): Y
Scope    ProxyPolicy     DefaultVIServerMode InvalidCertificateAction  DisplayDeprecationWarnings WebOperationTimeout
                                                                                                  Seconds
-----    -----------     ------------------- ------------------------  -------------------------- -------------------
Session  UseSystemProxy  Multiple            Warn                      True                       300
User                     Multiple

同状態で接続すると以下のように警告と共に証明書情報が表示されながらも接続が行えます。

* The X509 chain could not be built up to the root certificate.
* It is not possible to determine whether the certificate has been revoked. This can be due to the
certificate revocation list (CRL) being offline or unavailable.
* The online certificate revocation list (CRL) the X509 chain relies on is currently offline.
Certificate: [Subject]
  E=vmca@vmware.com, CN=xx, OU=VMware Engineering, O=VMware, L=Palo Alto, S=California, C=US
[Issuer]
  OU=VMware Engineering, O=xx, S=California, C=US, DC=local, DC=vsphere, CN=CA
[Serial Number]
  xx
[Not Before]
  xx
[Not After]
  xx
[Thumbprint]
  xx
The server certificate is not valid.

以上、ご参考になれば幸いです。