VMware Cloud Community
Praveenmna
Enthusiast
Enthusiast

Get License information of hosts in cluster using powercli

Hi ,

I am trying to collect License (Product Information) of hosts in cluster using Powercli script. Please help.

If you found this or any other answer useful please consider the use of the Helpful or Correct buttons to award points. Praveen P Senior Support Engineer
0 Kudos
1 Reply
illvilja
Hot Shot
Hot Shot

For getting licenses and usage you can use this snippet

$vSphereLicenseInfo = @()

$ServiceInstance = Get-View ServiceInstance

Foreach ($LicenseMan in Get-View ($ServiceInstance | Select -First 1).Content.LicenseManager) {

    Foreach ($License in ($LicenseMan | Select -ExpandProperty Licenses)) {

        $Details = "" |Select VC, Name, Key, Total, Used, ExpirationDate , Information

        $Details.VC = ([Uri]$LicenseMan.Client.ServiceUrl).Host

        $Details.Name= $License.Name

        $Details.Key= $License.LicenseKey

        $Details.Total= $License.Total

        $Details.Used= $License.Used

        $Details.Information= $License.Labels | Select -expand Value

        $Details.ExpirationDate = $License.Properties | Where { $_.key -eq "expirationDate" } | Select -ExpandProperty Value

        $vSphereLicenseInfo += $Details

    }

}

$vSphereLicenseInfo | Format-Table -AutoSize

Grzegorz Kulikowski has created this function which can help with individual hosts and generates a nice html report

https://psvmware.wordpress.com/tag/query-all-licenses-hosts-vms-vapps-powercli/

0 Kudos