VMware Cloud Community
CAE0621
Enthusiast
Enthusiast
Jump to solution

Getting "License" tab from Licensing

I'm working with this code I found online:

$vSphereLicInfo = @()
$ServiceInstance = Get-View ServiceInstance
Foreach ($LicenseMan in Get-View ($ServiceInstance | Select-Object -First 1).Content.LicenseManager) {
    Foreach ($License in ($LicenseMan | Select-Object -ExpandProperty Licenses)) {
        $Details =  "" | Select-Object 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-Object -expand Value
        $Details.ExpirationDate = $License.Properties | Where-Object { $_.key -eq "expirationDate" } | Select-Object -ExpandProperty Value
        $vSphereLicInfo += $Details
    }
}
$vSphereLicInfo | Format-Table -AutoSize

It works great to grab the VC, Name, Key, Total, Used, ExpDate, and Info. But what I need is "License". Here's some screenshots to explain further.

2021-08-24 10_15_24-Window.png

 

Above is the output of the script. As you can see, it pulls a property called "Name" . if you look below, what is marked as "Name" is actually "Product".

2021-08-24 10_18_11-Window.png

 

If you look at the License tab you can see that it has manually entered descriptions of what each license is to be used for. As the license script is part of a longer deploy script, it would be super useful to be able to see this information as opposed to the product name.

 

I tried seperating parts of the script, trying to expand the properties listed so I could see all the options available, but either I'm doing it incorrectly or the "License" option isn't available. Any help would be greatly appreciated!

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

That property is not available via any public API that I know of.

As was also stated in the thread that contains that snippet of code Solved: Re: Export all Licenses info + rename with PowerCL... - VMware Technology Network VMTN


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

1 Reply
LucD
Leadership
Leadership
Jump to solution

That property is not available via any public API that I know of.

As was also stated in the thread that contains that snippet of code Solved: Re: Export all Licenses info + rename with PowerCL... - VMware Technology Network VMTN


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference