1 Reply Latest reply on Mar 31, 2011 4:33 AM by RvdNieuwendijk

    ESXi licencing

    pauljawood Enthusiast

      Hi All,

      I'm looking for a way to add license’s to a VC and then applying these to the ESXi hosts in the environment. I do not think that a cmdlet has been created for this (not in the previous release) and would like to know how others have got around this.

       

      It would be great to be able load all the license information from csv file to the VC in one script and then run another script that would check all hosts and see if it is licensed. If the host is not licensed then to apply a licence to the host.

       

      All help will be gratefully taken.

        • 1. Re: ESXi licencing
          RvdNieuwendijk Virtuoso
          User ModeratorsvExpert

          I only have part of the solution. The next code adds a license to a host:

           

          $VMHost = Get-VMHost -Name "ESX1"
          $LicenseName = 'vSphere 4 Enterprise Plus'
          $targethostMoRef = $VMHost.ExtensionData.MoRef
          $si = Get-View ServiceInstance
          $LicManRef = $si.Content.LicenseManager
          $LicManView = Get-View $LicManRef
          $esxLicense = $LicManView.Licenses | Where-Object {$_.Name -eq $LicenseName}
          $licassman = Get-View $LicManView.LicenseAssignmentManager
          $licassman.UpdateAssignedLicense($targethostMoRef.value,$esxLicense.LicenseKey,$esxLicense.Name)
          
          


          Regards, Robert