Hi,
I have the code below which tells me the vCenter, the name of the key, the license key, the total number of licenses per key and the total used. However, I'd also like to see which hosts are using each key. Is there a way to achieve this in one script? My code is below, which I actually got from another forum (or perhaps this one)
$vSphereLicInfo = @()
$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
$Details.VC = ([Uri]$LicenseMan.Client.ServiceUrl).Host
$Details.Name= $License.Name
$Details.Key= $License.LicenseKey
$Details.Total= $License.Total
$Details.Used= $License.Used
$vSphereLicInfo += $Details
}
}
$vSphereLicInfo | Export-Csv $PSScriptRoot\report.csv -UseCulture