In VCF PowerCLI 9.0, the "Get-VIMachineCertificate" cmdlet parameters (`-EsxOnly` and `-VCenterOnly`) do not function as expected, returning zero(0) when attempting to retrieve certificates for ESXi hosts or vCenter Server.
VMware vCenter Server 8.x
VMware vCenter Server 9.x
VCF PowerCLI 9.0
This is a known issue, and a fix is planned for the VCF 9.0 P01 release.
In the interim, the following workarounds can be used to fetch ESXi and vCenter certificates separately:
Workaround:
Connect to vCenter Server:
$conn = Connect-VIServer -Server <vcenter-server> -User <username> -Password <password>
Get only vCenter Certificate:
$conn.GetClient().
Get all ESXi(s) Certificates:
$conn.GetClient().
Get Single ESXi Certificate:
$vmhost = Get-VMHost -Name <esxname>
$conn.GetClient().