4 Replies Latest reply on Jul 6, 2009 2:47 AM by cgrjones

    Basic VSphere License Key Install via PowerCLI Script

    cgrjones Novice


      Hi all,



      With the help of the community I was able to piece together a build script for ESXi 3.5 (basic/free edition). This script works fine with ESXi 4 (VSphere) but I am stuck on the section that completes the License Key install.



      The orgional code segment for ESXi 3.5 was this:




      $ESXHostView=$ESXHost | Get-View


      $ServiceInstance=Get-View -Server $ESXConnect ServiceInstance



      $LicManView=Get-View -Server $ESXConnect $LicManRef

      $LicServerSource=New-Object VMWARE.VIM.LocalLicenseSource

      $LicServerSource.LicenseKeys="11111-AAAAA-BBBBB-CCCCC-DDDDD "





      ...but now the licensing system has changed we need to do something else.  I have checked the new API v4.0 Reference and it has pointed me to where I can find the key but I dont know enough to get it to automatically assign.



      Source                   :

      SourceAvailable          : False

      Diagnostics              :

      FeatureInfo              : {}

      LicensedEdition          :

      Licenses                 : {ESXi 4 Single Server}

      LicenseAssignmentManager :

      Evaluation               : VMware.Vim.LicenseManagerEvaluationInfo

      MoRef                    : VMware.Vim.ManagedObjectReference

      Client                   : VMware.Vim.VimClient



      LicenseKey      : 11111-AAAAA-BBBBB-CCCCC-DDDDD (my basic v4 key)

      EditionKey      : esxBasic

      Name            : ESXi 4 Single Server

      Total           : 0

      Used            : 1

      CostUnit        : cpuPackage:6core

      Properties      : {ProductName, ProductVersion, feature, feature...}

      Labels          :

      DynamicType     :

      DynamicProperty :



      Any help on this will be greatly appreciated