Hi all!
How do i get the licensing information for a specific host using powercli.
From vCenter it is simple enough host -> configure -> Licensing
I'm specifically looking from product name.
using
The license information is largely separate from the VMHost object. It's queried from the vCenter License Manager service as the links provided by @LucD show. The "Product Name" is actually the Name property of the license object. A super quick way to query the license your host is using is this way:
> $VIConnection = Connect-VIServer -Server $VIServer -Credential $ViCreds
> $VMHostObj = Get-VMHost -Name "vmhost"
> $LicenseMgr = Get-View $VIConnection.ExtensionData.Content.LicenseManager
> $LicenseMgr.Licenses | Where-Object {$_.LicenseKey -eq $VMHostObj.LicenseKey}
LicenseKey : JUST0-SOME0-RANDM-TEXT0-CHARS
EditionKey : esx.enterprisePlus.cpuPackageCoreLimited
Name : vSphere 7 Enterprise Plus
Total : 18
Used : 12
CostUnit : cpuPackage:32core
Properties : {LicenseInfo, ProductName, ProductVersion, FileVersion...}
Labels :
(The license key is fake for obvious reasons.)
There are quite a few threads in this community on that subject.
For example
Solved: Re: Unable to get License Info from multiple vCent... - VMware Technology Network VMTN
Re: Fetch ESXi license name & expiration date with... - VMware Technology Network VMTN
A search should produce more examples
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The license information is largely separate from the VMHost object. It's queried from the vCenter License Manager service as the links provided by @LucD show. The "Product Name" is actually the Name property of the license object. A super quick way to query the license your host is using is this way:
> $VIConnection = Connect-VIServer -Server $VIServer -Credential $ViCreds
> $VMHostObj = Get-VMHost -Name "vmhost"
> $LicenseMgr = Get-View $VIConnection.ExtensionData.Content.LicenseManager
> $LicenseMgr.Licenses | Where-Object {$_.LicenseKey -eq $VMHostObj.LicenseKey}
LicenseKey : JUST0-SOME0-RANDM-TEXT0-CHARS
EditionKey : esx.enterprisePlus.cpuPackageCoreLimited
Name : vSphere 7 Enterprise Plus
Total : 18
Used : 12
CostUnit : cpuPackage:32core
Properties : {LicenseInfo, ProductName, ProductVersion, FileVersion...}
Labels :
(The license key is fake for obvious reasons.)
Thank you so much! This worked perfectly
If anyone is ever interested here is a complete script that exports to csv