PowerCLI: vSphere License Export

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:



$ServiceInstance=Get-View ServiceInstance
$LicenseMan=Get-View $ServiceInstance.Content.LicenseManager
$vSphereLicInfo= @()
Foreach ($Licensein$LicenseMan.Licenses){
	$Details="" |Select Name, Key, Total, Used,Information
	$Details.Information=$License.Labels |Select-expandValue
$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.


5 thoughts on “PowerCLI: vSphere License Export”

  1. hi Al, Have been a great fan of yours and also of the PowerCLI community. I had a query as to why this license reporting script shows the Product Evaluation licenses even though there are no hosts with this eval licenses being used and how to get rid of it.
    Appreciate your help on the same.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.