It took me ages to work up this script, mainly cos I have a brain that does not do scripting well. My thanks for pointers in this general direction to Carter, Alan and Hal, who all had contributions to my understanding of licensing via powershell in general in vSphere.
$ESXHosts = Get-VMHost | get-view
$ServiceInstance = Get-View ServiceInstance
$LicenseMan = Get-View $ServiceInstance.Content.LicenseManager
$licAssMan = Get-View $LicenseMan.LicenseAssignmentManager
$Report = @()
foreach ($ESXHost in $ESXHosts)
{
$Lic = "" | Select Host, LicKey, LicName
$LicUse = $LicAssMan.QueryAssignedLicenses($ESXHost.MoRef.value)
$Lic.Host = $ESXHost.Name
$Lic.LicKey = ($LicUse | % {$_.AssignedLicense}).LicenseKey
$Lic.LicName = ($LicUse | % {$_.AssignedLicense}).Name
$Report += $Lic
}
$Report
I hope someone else from this as well.
Derrick