Hi
I'm trying to export my licenses information to a CSV file using this script :
$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
}
}
But I can't export information in the column below :
I also want to rename a License with PowerCLI (couldn't find anything about it)
Please help me,
Thanks ,
JN
Afaik you can't get at the Name, again no public API afaik
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Which vSphere version are you using?
This seems to work for me (but that is in vSphere 6.5)
$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 .\report.csv -UseCulture
Afaik, there is no public API to rename a license entry
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you Luc,
I'm using vSphere 6.5 and it works fine but that "License" column is missing (License's name)
$Details.Name= $License.Name
That line returns the product's name not the license's name
Afaik you can't get at the Name, again no public API afaik
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ok, that's good to know.
Thank you Luc for your help,
Have a good day