I have showed you before how to access the License Manager with the Powershell VMware VI Toolkit. But the properties of the License Manager appear to only reflect the Virtual Center License Information. So how do we get information about licensing for each individual ESX Server?
We need to take a look at the methods of the License Manager.
First, we connect to the License Manager:
$SI = Get-View ServiceInstance
$LM = Get-View $SI.Content.LicenseManager
Examine the methods of the License Manager:
Lets see how the QueryLicenseUsage method works:
It requires one parameter host of type ManagedObjectReference. So we need a reference to a VMHost:
$VMHostView = Get-VMHost “NAME” | Get-View
$VMHostRef = $VMHostView.MoRef
Now we can call the method:
$LicUse = $LM.QueryLicenseUsage($VMHostRef)
Useful information includes:
$LicUse.Source.LicenseServer # Contains the license server name and port
To find more information about each feature, take a look at the FeatureInfo property of the License Manager:
Now, you can take the info you need and use it in your scripts.