vCenter

 View Only
  • 1.  Get License information of hosts in cluster using powercli

    Posted Mar 16, 2015 10:19 AM

    Hi ,

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



  • 2.  RE: Get License information of hosts in cluster using powercli

    Posted Mar 19, 2015 01:18 PM

    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/