Seeing Luc’s recent blog post where he explains how to add a vCenter License using PowerCLI, I thought I would stick with the licensing theme and show you how to export your vSphere License keys and details to a csv file enabling you to keep them backed up in a safe place.
This script will only work with vSphere as in vSphere the license server was removed and licensing became a great deal easier, if you want the v3 version you can grab it from my previous post here.
The output can be seen below:
Script:
$filename="C:\LicenseInformation.csv"
$ServiceInstance=Get-View ServiceInstance
$LicenseMan=Get-View $ServiceInstance.Content.LicenseManager
$vSphereLicInfo= @()
Foreach ($Licensein$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-expandValue
$vSphereLicInfo+=$Details
}
$vSphereLicInfo |Select Name, Key, Total, Used,Information | Export-Csv -NoTypeInformation $filename
I have included this in my new VESI PowerPack, the version in the PowerPack will automatically work out if your VI is V3 or V4 and show the appropriate information.
Pingback: VMware vSphere Blog: Retrieving vSphere License Information & Expiration using the vSphere API | Strategic HR
Pingback: VMware vSphere Blog: Retrieving vSphere License Information & Expiration using the vSphere API | Virtualization
Pingback: Retrieving vSphere License Information & Expiration using the vSphere API | VMware vSphere Blog - VMware Blogs
Any way to pull license expires data also?