4 Replies Latest reply on Aug 4, 2017 1:13 AM by vijayrana968

    Use POwercli to get License expiration dates

    moonrox Lurker

      I found and am using the code below to print license information.  However i am looking for the expires date of the license and I don't see a way to get that.

       

      Here is an example......  I would like to modify this to also include the license expires data. The data is available in the full GUI.  So I should be able to get it.

       

      $filename

      = “C:\scripts\vcenter\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“

      }

      $vSphereLicInfo|gm