1 Reply Latest reply on Apr 27, 2012 11:10 AM by LucD

    Help required modifying a licence script

    StuartB201110141 Novice

      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“
      }