VMware Cloud Community
StuartB20111014
Enthusiast
Enthusiast

Help required modifying a licence script

Hi Everyone,

I need to do a little job that requires me to get licence types, cpu counts etc on a lot of ESXi clusters.

I can't run them against all the clusters at once. I would like to be able to do one cluster at a time. I found the script at:http://www.virtu-al.net/2009/10/30/powercli-vsphere-license-export/ but I am not sure how to modify it. I understand what it does, and it gets the info i require. It's the SDK bit I dont understand how to modify/use. The script to do it all at once is as follows (from the link above, NOT my work!) I did try to modify it but it was a bit of a stab in the dark that didn't get me far.

$filename = “C:\LicenseInformation.csv“
If ((Get-View ServiceInstance).Content.About.Version-ge “4.0.0“){
$ServiceInstance = Get-View ServiceInstance
$LicenseMan = Get-View $ServiceInstance.Content.LicenseManager
$vSphereLicInfo = @()
Foreach ($License in $LicenseMan.Licenses){
$Details = “” |Select Name, Key, Total, Used,Information
$Details.Name= $License.Name
$Details.Key= $License.LicenseKey
$Details.Total= $License.Total
$Details.Used= $License.Used
$Details.Information= $License.Labels |Select -expand Value
$vSphereLicInfo += $Details
}
$vSphereLicInfo |Select Name, Key, Total, Used,Information |Export-Csv -NoTypeInformation $filename
}
Else {
Write “Sorry V4 Only“
}

0 Kudos
1 Reply
LucD
Leadership
Leadership

Alan's script will fetch all the licenses that are entered on the vCenter.

And I don't think you assign licenses to clusters, only ESX(I) hosts.

Do you want to see which license is assigned to which ESX(i) host ?


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

0 Kudos