How to simplify and automate VMware ImageBuilder with the ESXi-Customizer-PS script

I published a new and improved version of my ESXi-Customizer-PS script today. This PowerCLI script greatly simplifies and automates the process of creating fully patched and customized ESXi 5.x installation ISOs using the VMware PowerCLI ImageBuilder snapin.

Over time I added more and more options to the script, and I think it is time now to provide a detailed tutorial to show how to make efficient use of it. Grab the latest version (1.3) from my Google Code page and give it a try. The only prerequisite you need is an installation of the current VMware vSphere PowerCLI.

1. The simplest use case: Create an ESXi 5.x installation ISO with the current patch level

If you call the script without any parameters then it will just connect to the VMware ESXi Online depot and create an ESXi 5.x installation ISO with the most current patch level from it:

How to create a fully patched ESXi 5.x installation ISO
The ISO file will be stored in the directory where the script itself resides (see 5. for how to override this).

2. Create an installation ISO from an Offline bundle

The -izip parameter enables you to feed a patch offline bundle to the script instead of using the VMware Online depot (in case you do not have an Internet connection on the machine that runs the script). You can download ESXi patch offline bundles from the VMware patch download portal.

Export a patch offline bundle into an installation ISO

3. Add 3rd-party Offline bundles (e.g. hardware drivers)

If you want to add 3rd-party Offline bundles (e.g. hardware drivers) to the exported ISO then you just need to copy them into a common directory and specify that using the -obDir parameter. In the following example I have copied a self-made Offline bundle (that adds a firewall rule to allow incoming NTP queries, see my earlier post) into the directory U:\temp\zip:

Create a customized ISO by adding Offline bundles
Please note: If the package(s) added with the Offline bundle(s) require an acceptance level that is lower than that of the ImageProfile (like in this example) then the ImageProfile's acceptance level will be automatically adjusted.

4. Adding drivers from the HP Online depot

HP provides an own Online depot (http://vibsdepot.hp.com) with hardware management packages for their ProLiant servers. If you are using HP hardware for your VMware hosts then you can use the parameters -hp and -hprel to add these packages to your customized ISO. With the -hprel parameter you can select a specific release set of the HP packages. These are named after the month of their release in the format mmmYYYY (jun2012 in the below example, see http://vibsdepot.hp.com/hpq/ for a current listing). If you omit the -hprel parameter then the script will use the most current versions of the packages.

Adding the HP Online depot to the customized ISO

5. Other options
  • -isoDir: lets you specify a directory for storing the customized ISO file (the default is the script directory)
  • -sip: displays a menu of all available ImageProfiles and lets you pick one of them (instead of automatically choosing the most current standard profile). Use this if you want to intentionally use an older patch level or a -notools profile.
  • -ipname : by default the name of a customized ImageProfile is automatically derived from the original profile's name (by adding the string "-customized"). You can override this behavior by specifying an arbitrary ImageProfile name using this parameter.
  • -nsc: Using this parameter will add the -NoSignatureCheck flag to the command that exports the ImageProfile into the ISO file. You will need this if you want to add incorrectly signed packages (like HP's jun2012 version of the hpvsa driver, see this community thread for more background) which otherwise cause error messages like "Could not find a trusted signer".
  • -test: This flag is useful if you just want to quickly test and see what the script is going to do without actually exporting/creating the ISO file.
6. Help!

Of course you can combine most of the aforementioned parameters, and - if you do not have this tutorial at hand - you can always use the -help switch to get an overview on how to build more complex script calls:

ESXi-Customizer-PS v1.3 help screen



17 comments:

  1. Great script! Still a bit confused what patches I need for my ML110 G7.
    I'm wondering what the Bundles like complete, management and hpnmi do. Can't find clear answers on HP.

    I'm running auto deploy on 5.1 Any suggestions on what might be the best way to run the script in my case?

    Regards

    ReplyDelete
  2. Would it be possible to make the output a depot for Auto Deploy instead of a iso?

    Regards

    ReplyDelete
    Replies
    1. Hi Eugene,

      yes, you can do this with the latest version of the ESXi-Customizer-PS script by using the -ozip parameter. See http://www.v-front.de/2012/09/updated-esxi-customizer-ps-script.html

      - Andreas

      Delete
  3. Oeps I missed the -ozip option! Man, did you save me a lot of headaches! Finally a HP custom image ready to be used in Auto Deploy. Made my day, Thanks a lot, will do a post at my vkumo.com amateur site ;)

    ReplyDelete
  4. Is it possible to include a single .vib from a directory? In my case that would be NetAppNasPlugin.v18.vib

    ReplyDelete
    Replies
    1. Not directly. If the vendor does really not provide an Offlien bundle then you can convert the vib file into an Offline bundle yourself with vib2zip.cmd from my Community Packaging Tools: http://esxi5-cpt.v-front.de

      Delete
  5. I tried adding it by using your windows ESXi-Customizer after creating the iso with the Customizer PS script. Seems to work, but have to do an install to be sure.

    ReplyDelete
  6. Hi,
    very nice utilities and great work!
    I have one question.
    For my lab-environment i want to have my LOCAL harddisks available in Vcenter in the Hardware-statustab.
    Until now this isn`t working because the internal Sata-controller isn`t supported i think?
    I am using HP8200 Elite SFF for my lab-environment.

    What do i need to have to local harddisks available in the hardware-status in Vcenter?

    Thx

    ReplyDelete
    Replies
    1. You would need an Offline Bundle with WBEM providers that supports your disk controller. E.g. HP has these for their SmartArray controllers. But for SATA-Controllers there is nothing available, I'm afraid.

      For monitoring SATA hard disks you could use the new SMART capabilities of esxcli, but this is not vCenter integrated. See http://www.v-front.de/2012/10/new-esxcli-namespaces-incl-smart-disk.html

      Delete
    2. I see that you use HP Elite 8200 like me for ESXi hosts. Have you tried to upgrade to/install ESXi v5.5 on your Elite 8200? Mine freezes at "initializing ACPI" during installation.

      Delete
  7. Great script. Found a bug though.

    When making an HP ESXi ISO:

    Running ".\ESXi-Customizer-PS-v1.4.3.ps1 -obDir C:\VM_Build\ZIP\HP\ -ipname HP-ESXi-5.1.0_U1_1157734-standard-iso" grabs the drivers from the Offline ZIP and downloads the latest ESXi standard image, but does not download the latest patch and apply it.

    Running ".\ESXi-Customizer-PS-v1.4.3.ps1 -izip C:\VM_Build\PATCH\ESXi510-201307001.zip -obDir C:\VM_Build\ZIP\HP\ -ipname HP-ESXi-5.1.0_U1_1157734-standard-iso" does not update the image, but does "add" the update patch in the list along with the drivers.



    The only way I see it make the image and update it is with the following.

    .\ESXi-Customizer-PS-v1.4.3.ps1 -hp -ipname HP-ESXi-5.1.0_U1_1157734-standard-iso


    This however only downloads 8 driver packages from the HP VIB Depot. The offline bundle has more than 20 VIB's that are successfully imported.


    Can the script use the offline bundle AND download and apply the latest patch bundle?

    ReplyDelete
    Replies
    1. I don't see the bug here ... If you add "-hp" to your first command and run it like this:

      ".\ESXi-Customizer-PS-v1.4.3.ps1 -obDir C:\VM_Build\ZIP\HP\ -hp -ipname HP-ESXi-5.1.0_U1_1157734-standard-iso"

      then it will create an ISO with the latest ESXi 5.1 build (of July 2013), including the Offline Bundles of http://vibsdepot.hp.com plus any Offline Bundles that you have stored in C:\VM_Build\ZIP\HP\.

      Please note that the script will not connect to the VMware Online depot if you use the -izip option. These options are mutually exclusive.

      I guess the real reason for your confusion is your assumption that you need to apply the current ESXi patch (of 07/2013) on top of Update 1, but this is not true. ESXi 5.x patch bundles are CUMULATIVE, so the July bundle includes U1 and any prior patch.
      See this post for further information on this topic:
      http://www.v-front.de/2012/11/are-esxi-5x-patches-cumulative.html

      Regards
      Andreas

      Delete
    2. When I build it using the command above, it lists the VMKernel Release Build as 1065491, which is the latest VMKernel from July.

      When I build it with just the "-hp" command, the VMKernel Release Build is 1157734, which is the VMKernel included in the latest cumulative patch.

      ESXi510-201307001
      Product:ESXi (Embedded and Installable) 5.1.0
      md5sum:24065646806665d176a373bf9a861f98
      sha1sum:c07a9361df8d9adcd2ff1f8e949d41fbeb091f0f
      Download Size:610.5 MB
      Build Number:1157734
      KB 2052143
      Release Date:07/25/2013
      System Impact:VM Shutdown & Host Reboot

      Delete
    3. Derek,

      that is super strange. For me the command

      ".\ESXi-Customizer-PS-v1.4.3.ps1 -obDir C:\VM_Build\ZIP\HP\ -hp -ipname HP-ESXi-5.1.0_U1_1157734-standard-iso"

      builds an ISO with the latest ESXi 5.1 build 1157734.

      Can you please send me the full output of your script run via e-mail to info(at)v-front.de?

      You could also try adding the -sip option to interactively select an image profile from the VMware Online depot.

      Thanks
      Andreas

      Delete
  8. Hi, Andreas!
    I'm a little bit modified your PS script. Added 3 new key (-v51, -ipvendor, -ipdesc), in my opinion, is quite useful.
    If you review my code, and feel it's necessary you can sign and update the script to your Google Code page with my modification.
    ESXi-Customizer-PS-v1.5.ps1 (http://pastebin.com/sthd0LHx)

    Thank you very much for this script, for me it was very useful.

    ReplyDelete
    Replies
    1. Hi Pedro,

      thank you very much for your suggestions! I'm currently working on a new major version of the ESXi-Customizer-PS script and I have already included the -v51 switch there (the need for this is obvious after the release of ESXi 5.5).
      I will also add the -ipvendor and -ipdesc parameters that you suggested, and I hope that I can get this out during the coming week.

      - Andreas

      Delete

***** All comments will be moderated! *****
- Please post only comments or questions that are related to this post's contents!
- Advertising and link spamming will not be tolerated!