WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud
  • Tanzu
    • Application Modernization
    • Tanzu services
    • Tanzu Community Edition
    • Tanzu Kubernetes Grid
    • vSphere with Tanzu
  • Home Lab
  • Nested Virtualization
  • Apple
You are here: Home / Automation / Creating custom ESXi images using vSphere Lifecycle Manager (vLCM) UI and PowerCLI cmdlets for vSphere 8

Creating custom ESXi images using vSphere Lifecycle Manager (vLCM) UI and PowerCLI cmdlets for vSphere 8

11.22.2022 by William Lam // 9 Comments

I have started to use vSphere Lifecycle Manager (vLCM) more and more, especially after upgrading to vSphere 8 as it will be the primary lifecycle management solution going forward for both vSphere image and configuration management.

The other reason for using vLCM is that vSphere Update Manager (VUM) baselines have also been deprecated in vSphere 8 and while you can still use it for now, it should not come as a surprise that VUM and its functionality will be removed in the future and all of its workflows including the use of vSphere Image Builder should also be transitioned over to using vLCM.

One of the most common and basic workflow for customers today is creating custom ESXi images (ISO or Offline Bundle) that includes additional ESXi drivers. Since vLCM is probably new to most folks (including myself), I wanted to share how you can create your own custom ESXi images using both the vLCM UI (which can be a bit non-intuitive) as well as the new PowerCLI cmdlets that was jus released today as part of PowerCLI 13.0 release that adds support for both vLCM and vSphere 8!

vLCM UI

Step 1 - In the upper left hand corner of the vSphere UI, navigate to Lifecycle Manager. If you need to import a new driver into vLCM depot, click on Actions->Import Updates and select the ESXi component driver (ZIP) that you wish to upload.


Step 2 - Since vLCM operates at a vSphere Cluster level, we are simply going to create a "dummy" vSphere Cluster that will be used to define our custom ESXi image. Make sure the "Manage all hosts in the cluster with a single image" option is selected which enables vLCM and then choose the "Compose a new image" setting.


Next, you need to specify the ESXi base image for the cluster, select ESXi 8.0 or any other version that desire.

Step 3 - During the creation of a vSphere Cluster, you can NOT add additional ESXi component drivers to ESXi base image, this must be done AFTER. If you need to associate additional ESXi component drivers, click on the vSphere Cluster and navigate to Updates->Hosts->Image and click on the Edit button. Here you can add additional vendor firmware and driver add-ons and underneath, you will see Components. Click on the Add Components and select the specific ESXi component(s) from the vLCM depot that you wish to add to ESXi base image.


Step 4 - Finally, to export our new custom ESXi image, click on the "three dots" and then select Export.


You can choose from ISO or an Offline Bundle ZIP, similar to what vSphere Image Builder supports today.


At this point, you now have your new custom ESXi ISO from vLCM!

vLCM PowerCLI

Step 0 - If you need to import a new driver into vLCM depot, unfortunately this functionality is not available in the new vLCM PowerCLI cmdlets. You will need to use the vLCM UI to perform this operation first

Step 1 - Connect to your vCenter Server using the Connect-VIServer cmdlet:

Connect-VIServer -Server vcsa.primp-industries.local -user administrator[at]vsphere[dot].local

Step 2- Define the ESXi base image name and ESXi components you wish to use. You can use the new Get-LcmImage cmdlet and pass specify -Type filter with either BaseImage or Component to get the specific name and/or version to populate the variables.

$datacenterName = "Primp-Datacenter"
$clusterName = "vLCM-Dummy-Cluster"
$esxiImageName = "8.0 GA - 20513097"
$esxiComponentName = "VMware USB NIC Fling Driver"
$esxiComponentVersion = "1.11-1vmw"

Step 3 - Using the variables defined above, we will now fetch the ESXi base image and ESXi component from vLCM depot using the Get-LcmImage cmdlet and save the output to two new variables which will be referenced in the next step.

$esxiBaseImage = Get-LcmImage -Type BaseImage -Version $esxiImageName
$esxiComponent = Get-LcmImage -Type Component | where {$_.Name -eq $esxiComponentName -and $_.Version -eq $esxiComponentVersion}

Step 4 - Next, we will create our "dummy" vSphere Cluster and associate that with our ESXi base image. Once the vSphere Cluster has been created, we will update it to associate the additional ESXi components and then finally we export to ISO using the new Export-LcmClusterDesiredState cmdlet.

New-Cluster -Name $clusterName -BaseImage $esxiBaseImage -Location (Get-Datacenter -Name $datacenterName)
Get-Cluster -Name $clusterName | Set-Cluster -Component @($esxiComponent) -BaseImage $esxiBaseImage -Confirm:$false
Export-LcmClusterDesiredState -Cluster (Get-Cluster -Name $clusterName) -ExportIsoImage

Once the process has completed, you will find both both an ISO and JSON file that has been exported from vLCM using the same name as your vSphere Cluster.

  • vLCM-PCLI-desired-state-spec.json
  • vLCM-PCLI-iso-image.iso

At this point, you are now ready to use your new ESXi ISO from vLCM!

Hopefully this article gave you a quick understanding of how to create custom ESXi images and I really do like the simplicity that vLCM provides in terms of constructing a custom ESXi image, which starts with the ESXi version and then it is additive with vendor firmware/add-on and then finally additional component drivers. The vLCM UI is certainly a welcome enhancement over the current vSphere Image Builder which in my opinion still has too many steps, like needing to clone an image profile to be able to construct a new image.

More from my site

  • Using vSphere Lifecycle Manager (vLCM) API to patch group of ESXi hosts
  • PowerCLI 13.0 on Photon OS
  • How to configure Hardware Compatibility List (HCL) database for vSphere Lifecycle Manager (vLCM) in an air-gapped environment?
  • Heads Up - Unable to open VIB archive in streaming mode using Export-EsxImageProfile with PowerCLI 13.0
  • How to install PowerCLI 13.0 and use new Image Builder & Auto Deploy cmdlets on Apple Silicon?

Categories // Automation, ESXi, PowerCLI, vSphere 8.0, vSphere Web Client Tags // PowerCLI, vSphere Lifecycle Manager, vSphere UI

Comments

  1. Kevin Martin says

    11/23/2022 at 4:44 am

    It seems that the deprecation of standard baselines will force me to create more clusters, and buy more hardware.
    I will typically have different generation servers in the same cluster, and for some, different vendor server(ex: hpe and cisco). Even if the same vendor, could potentially need different drivers for different generations.

    Thoughts on this? Is VMware aware of this potential impact on their customers?

    Reply
  2. parambil says

    11/23/2022 at 8:36 am

    Does the image builder commandlets let you build the custom images with vSphere 8? Going to check out next week when in office. Will update the findings here.

    Now the image based remediation is at the cluster level, it's going to be pain to manage hundreds if not thousands of ESXi clusters.

    Reply
    • William Lam says

      11/23/2022 at 2:17 pm

      Yes, but make sure you either use VC 8.0 via Image Builder UI or PCLI 13 that supports vSphere 8

      While vLCM is managed at a cluster level, remediation can be at cluster (ideally how you’d roll out changes), but you can also select specific hosts to remediate but not sure why this would be “pain” given that’s how VUM remediation works too 🙂

      Reply
      • parambil says

        11/28/2022 at 10:52 am

        Thanks William. Plan to use PLCI 13.

        Pain in the sense, to remediate 100s of hosts in a VC, times 100 VC. Using UM, you can remediate at the vCenter level. Now, I believe, I had to do it at the cluster level.

        Reply
  3. Przemek Wirkus says

    11/24/2022 at 5:41 am

    When I`m building image, do I need to know about all the "Non-Critical Host Patches (Predefined)" and add them manually? As is my understanding baselines automatically have information about the patches and implement them accordingly to needs. With vLCM should i add them ass additional packages when there is no next base image version?

    Also what Kevin said, having different hadrware version is blocking implementing vLCM.

    Reply
  4. gcbeta says

    11/28/2022 at 9:11 pm

    The image was successfully exported. You are great. The image profile name is "VMware Lifecycle Manager Generated Image". Can you tell me how to customize this name, Just like we used powercli "new-EsxImageProfile -CloneProfile“ before. thank you.

    Reply
    • William Lam says

      11/29/2022 at 6:04 am

      I don't believe you can customize the profile name, I just took a look at the vLCM API https://developer.vmware.com/apis/vsphere-automation/latest/esx/api/esx/settings/clusters/cluster/softwareactionexport/post/ and there's no options for that

      Reply
  5. Mirza says

    12/04/2022 at 12:01 pm

    Hi, When i want to export ISO image i get this error:

    Export-EsxImageProfile : Error retrieving file for VIB 'VMW_bootbank_lsi-mr3_7.718.02.00-1vmw.703.0.20.19193900':
    ('vib20/lsi-mr3/VMW_bootbank_lsi-mr3_7.718.02.00-1vmw.703.0.20.19193900.vib', "Unable to open VIB archive in streaming
    mode: '_SharedFile' object has no attribute 'writing'").
    At line:1 char:1
    + Export-EsxImageProfile -ImageProfile "ESXi7-IntelNUC" -ExportToIso -F ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Export-EsxImageProfile], FaultException
    + FullyQualifiedErrorId : System.ServiceModel.FaultException,VMware.ImageBuilder.Commands.ExportProfile

    Reply
    • William Lam says

      12/04/2022 at 2:24 pm

      See https://williamlam.com/2022/11/heads-up-unable-to-open-vib-archive-in-streaming-mode-using-export-esximageprofile-with-powercli-13-0.html

      Reply

Thanks for the comment! Cancel reply

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

Search

Author

William Lam is a Senior Staff Solution Architect working in the VMware Cloud team within the Cloud Infrastructure Business Group (CIBG) at VMware. He focuses on Cloud Native technologies, Automation, Integration and Operation for the VMware Cloud based Software Defined Datacenters (SDDC)

Connect

  • Email
  • GitHub
  • LinkedIn
  • RSS
  • Twitter
  • Vimeo

Recent

  • Automated ESXi Installation with a USB Network Adapter using Kickstart 02/01/2023
  • How to bootstrap ESXi compute only node and connect to vSAN HCI Mesh? 01/31/2023
  • Quick Tip - Easily move or copy VMs between two Free ESXi hosts? 01/30/2023
  • vSphere with Tanzu using Intel Arc GPU 01/26/2023
  • Quick Tip - Automating allowed and not allowed Datastores for use with vSphere Cluster Services (vCLS) 01/25/2023

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2023

 

Loading Comments...