WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Hardware Options
    • Hardware Reviews
    • Lab Deployment Scripts
    • Nested Virtualization
    • Homelab Podcasts
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Automated ESXi Installation to USB using Kickstart

Automated ESXi Installation to USB using Kickstart

07.09.2019 by William Lam // 21 Comments

I frequently re-install ESXi on my physical host for various types of testing as I normally work with a number of future releases. Although the process just takes a couple of minutes, having to enter the exact same information each time and also requiring a keyboard and monitor is not really ideal. For the majority, this is really not a problem and manually going through the install workflow is fine for most folks, especially as this is an infrequent operation.

However, with some recent customer conversations, I thought it was worth while to re-visit this topic and demonstrating just how easy it is to automate the installation of ESXi with just a single bootable USB device and embedding an ESXi Kickstart Script. Even for infrequent installation and/or upgrades of ESXi for home labs, this can be a time saver, especially if you do not have monitor and keyboard just lying around. Below are instructions including a reference Kickstart example that folks can use as a starting point. For more advanced automation, please take a look at my ESXi Kickstart Resources as well as the official VMware documentation for ESXi Scripted Installations.

Step 1 - Create a bootable ESXi image on a USB device using any ESXi ISO downloaded from VMware. I personally use Unetbootin for this process and the tool is multi-platform which is also really nice. Do not eject or unplug the device after the flashing has completed.

Step 2 - Using a code editor like Microsoft Code, open both BOOT.CFG and EFI/BOOT/BOOT.CFG from the USB device and replace the default kernelopt=cdromBoot runweasel with kernelopt=ks=usb:/KS.CFG which tells ESXi to not start the default interactive installer but rather a scripted install and look for the Kickstart file in the root of the USB device, which we will create in the next step.

bootstate=0
title=Loading ESXi installer
timeout=5
prefix=
kernel=/b.b00
kernelopt=ks=usb:/KS.CFG
modules=/jumpstrt.gz --- /useropts.gz --- /features.gz --- /k.b00 --- /chardevs.b00 --- /user.b00 --- /procfs.b00 --- /uc_intel.b00 --- /uc_amd.b00 --- /uc_hygon.b00 --- /vmx.v00 --- /vim.v00 --- /sb.v00 --- /s.v00 --- /ata_liba.v00 --- /ata_pata.v00 --- /ata_pata.v01 --- /ata_pata.v02 --- /ata_pata.v03 --- /ata_pata.v04 --- /ata_pata.v05 --- /ata_pata.v06 --- /ata_pata.v07 --- /block_cc.v00 --- /bnxtnet.v00 --- /bnxtroce.v00 --- /brcmfcoe.v00 --- /char_ran.v00 --- /ehci_ehc.v00 --- /elxiscsi.v00 --- /elxnet.v00 --- /hid_hid.v00 --- /i40en.v00 --- /iavmd.v00 --- /igbn.v00 --- /ima_qla4.v00 --- /ipmi_ipm.v00 --- /ipmi_ipm.v01 --- /ipmi_ipm.v02 --- /iser.v00 --- /ixgben.v00 --- /lpfc.v00 --- /lpnic.v00 --- /lsi_mr3.v00 --- /lsi_msgp.v00 --- /lsi_msgp.v01 --- /lsi_msgp.v02 --- /misc_cni.v00 --- /misc_dri.v00 --- /mtip32xx.v00 --- /ne1000.v00 --- /nenic.v00 --- /net_bnx2.v00 --- /net_bnx2.v01 --- /net_cdc_.v00 --- /net_cnic.v00 --- /net_e100.v00 --- /net_e100.v01 --- /net_enic.v00 --- /net_fcoe.v00 --- /net_forc.v00 --- /net_igb.v00 --- /net_ixgb.v00 --- /net_libf.v00 --- /net_mlx4.v00 --- /net_mlx4.v01 --- /net_nx_n.v00 --- /net_tg3.v00 --- /net_usbn.v00 --- /net_vmxn.v00 --- /nfnic.v00 --- /nhpsa.v00 --- /nmlx4_co.v00 --- /nmlx4_en.v00 --- /nmlx4_rd.v00 --- /nmlx5_co.v00 --- /nmlx5_rd.v00 --- /ntg3.v00 --- /nvme.v00 --- /nvmxnet3.v00 --- /nvmxnet3.v01 --- /ohci_usb.v00 --- /pvscsi.v00 --- /qcnic.v00 --- /qedentv.v00 --- /qfle3.v00 --- /qfle3f.v00 --- /qfle3i.v00 --- /qflge.v00 --- /sata_ahc.v00 --- /sata_ata.v00 --- /sata_sat.v00 --- /sata_sat.v01 --- /sata_sat.v02 --- /sata_sat.v03 --- /sata_sat.v04 --- /scsi_aac.v00 --- /scsi_adp.v00 --- /scsi_aic.v00 --- /scsi_bnx.v00 --- /scsi_bnx.v01 --- /scsi_fni.v00 --- /scsi_hps.v00 --- /scsi_ips.v00 --- /scsi_isc.v00 --- /scsi_lib.v00 --- /scsi_meg.v00 --- /scsi_meg.v01 --- /scsi_meg.v02 --- /scsi_mpt.v00 --- /scsi_mpt.v01 --- /scsi_mpt.v02 --- /scsi_qla.v00 --- /sfvmk.v00 --- /shim_isc.v00 --- /shim_isc.v01 --- /shim_lib.v00 --- /shim_lib.v01 --- /shim_lib.v02 --- /shim_lib.v03 --- /shim_lib.v04 --- /shim_lib.v05 --- /shim_vmk.v00 --- /shim_vmk.v01 --- /shim_vmk.v02 --- /smartpqi.v00 --- /uhci_usb.v00 --- /usb_stor.v00 --- /usbcore_.v00 --- /vmkata.v00 --- /vmkfcoe.v00 --- /vmkplexe.v00 --- /vmkusb.v00 --- /vmw_ahci.v00 --- /xhci_xhc.v00 --- /elx_esx_.v00 --- /btldr.t00 --- /esx_dvfi.v00 --- /esx_ui.v00 --- /esxupdt.v00 --- /weaselin.t00 --- /lsu_hp_h.v00 --- /lsu_inte.v00 --- /lsu_lsi_.v00 --- /lsu_lsi_.v01 --- /lsu_lsi_.v02 --- /lsu_lsi_.v03 --- /lsu_lsi_.v04 --- /lsu_smar.v00 --- /native_m.v00 --- /qlnative.v00 --- /rste.v00 --- /vmware_e.v00 --- /vsan.v00 --- /vsanheal.v00 --- /vsanmgmt.v00 --- /tools.t00 --- /xorg.v00 --- /imgdb.tgz --- /imgpayld.tgz
build=
updated=0

Step 3 - Using a code editor like Microsoft Code, create a new file called KS.CFG (it must be all capitalized) on the root USB device which will contain the ESXi installation configuration and any additional automation you wish to run. Below is a very basic ESXi Kickstart which sets a static network address, password, enables ESXi Shell/SSH, suppresses the UI warnings and will then automatically install ESXi on the same USB device. For more advanced automation, please see the references noted earlier.

vmaccepteula
install --firstdisk=usb --overwritevmfs --novmfsondisk
reboot

network --bootproto=static --ip=192.168.30.13 --netmask=255.255.255.0 --gateway=192.168.30.1 --hostname=hades-canyon.primp-industries.com --nameserver=192.168.30.1 --addvmportgroup=1
rootpw VMware1!

%firstboot --interpreter=busybox

# enable & start SSH
vim-cmd hostsvc/enable_ssh
vim-cmd hostsvc/start_ssh

# enable & start ESXi Shell
vim-cmd hostsvc/enable_esx_shell
vim-cmd hostsvc/start_esx_shell

# Suppress ESXi Shell warning
esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 1

Step 4 - Eject the USB device and plug that into your physical ESXi host and just power it on and watch the magic happen 🙂 Once the system reboots, it should be accessible on your network assuming everything was configured correctly.

More from my site

  • How to automate VM deployment from large USB keys using ESXi Kickstart?
  • Quick Tip - Automating cpuUniformityHardCheckPanic configuration for ESXi Kickstart with USB
  • How to prevent physical CD-ROM from ejecting after installing or upgrading ESXi?
  • Revisiting prompting for user input during an interactive or scripted install of ESXi
  • How to prompt for user input during an interactive or scripted install of ESXi?

Categories // Automation, ESXi, vSphere Tags // ESXi, kickstart, ks.cfg, usb

Comments

  1. *protectedOmer says

    07/10/2019 at 12:33 am

    Nice writeup William. Thanks for sharing !!

    I use a nested ESXi setup and need to reinstall ESXI hosts multiple times a month. For now, i follow the console based setup on to a vmdk.

    Do you think we could automate that too ? And if so any direction would help.

    Thanks

    Reply
    • *protectedJean Laganière says

      07/11/2019 at 7:00 am

      Omer, why don't you just use Vmware snapshots instead of reinstalling you nested ESXI hosts?

      Reply
  2. *protectedJean Laganière says

    07/11/2019 at 7:09 am

    William, maybe I missed something, but if you install ESXi on the same USB drive from which you have booted, this would mean you cannot reuse it for future reinstallation? You would then need to recreate a new USB with unetbootin, edit boot.cfg and kickstart file etc?

    Reply
    • William Lam says

      07/11/2019 at 7:48 am

      Yes, that's correct. It all depends on what you're trying to do 🙂 If you're hardcoding the IP, then it's not really useful beyond a single installation or you're constantly updating it. The point here is that you can automate a single or many installations. My example showed installing on the same USB key (as that's quite common for home labs). You can certainly install onto another USB device or even a local disk

      Reply
  3. *protectedFabian Dietl says

    07/24/2019 at 2:05 am

    Cheers guys, we use a standard password containing a # which is implying a comment... 'password#1' doesn't seem to fix it, any suggestions besides changing the password? 😛

    Thanks in advance!

    Reply
  4. *protectedJames Bishop says

    10/28/2019 at 1:34 pm

    I've found in testing that when using Rufus to create the USB stick, it's best to select MBR instead of GPT. I found when using GPT that it failed to find KS.CFG.

    Reply
    • *protectedDavid Dreggors says

      05/07/2020 at 6:06 am

      I also have this issue, I have found many articles that say to call for the file name in uppercase as well so I tried that too (i.e. ks=cdrom:/ks.cfg and ks=cdrom:/KS.CFG) and neither test case works, file is never found.

      I place the same ks.cfg on an http server and I can use it just fine though.

      Reply
  5. *protectedjojo says

    02/28/2020 at 11:07 pm

    tried to use unetbootin and rufus, but failed to find KS.CFG on the usb.
    install goes until to search for kickstart file and hang up with the following
    "exception.HandledError: Error (See Log for more info) cannot find kickstart file on usb with path -- /ks.cfg"

    used ks=usb:/KS.CFG
    but
    it s working with ks=cdrom:/KS.CFG

    could not find any info
    any help William?

    Reply
  6. *protectedVarun Kumar says

    05/12/2020 at 8:44 am

    While I use NFS path, the KS file is getting accepted but once it completes line 5 & 6 it is showing installation is completed successfully, whereas I have vswitch configuration are written (it is not accepting those lines).

    The same script is running when I mount KS.CFG file into the iso and boot using ILO (virtual CD device).

    Reply
  7. *protectedsample1 says

    12/30/2021 at 8:27 am

    Sorry, i have a question:

    it's possible on firstboot option make a reboot and resume firstboot after reboot?

    Reply
  8. *protectedKeith says

    01/07/2023 at 2:56 pm

    Hi, in the line:
    install --firstdisk=usb --overwritevmfs --novmfsondisk
    what does the option "--novmfsondisk" do? I could not find anything on it.

    Reply
  9. *protectedKiran Basawaraj Zond says

    02/09/2023 at 12:57 pm

    Is it possible to automate esxi deployment without having dhcp ?

    Reply
    • William Lam says

      02/09/2023 at 1:48 pm

      Yes, it’s called statically assigned networking 🙂

      Reply
  10. *protectedShane says

    03/06/2024 at 9:04 am

    This link gets a 404
    https://www.williamlam.com/vmware-kickstart?_gl=1*1e4opbu*_ga*MTA5Njk1NTk3NC4xNzA5NjY4NDM2*_ga_4XVSZD148F*MTcwOTc0NDQxMy4yLjEuMTcwOTc0NDUyNC4wLjAuMA..

    Reply
    • William Lam says

      03/06/2024 at 9:11 am

      Fixed. It should have just pointed you to all posts tagged with "kickstart"

      Reply
  11. *protectedRSS says

    05/16/2024 at 8:03 am

    good morning William, in what environment (bios, esx pre-boot, etc) does the network command run? Trying to tshoot an issue on a specific hardware platfrom.

    Reply
    • William Lam says

      05/17/2024 at 5:48 am

      This is when ESXi installer is fully booted up (definitely after BIOS, etc). Best way to debug is to manually load it up installer, then switch to console and see if you're able to reach a certain network/etc.

      Reply
  12. *protectedTony says

    12/05/2024 at 7:14 am

    How do i get a boot menu on UEFI boot? I am creating a custom iso but need to do kickstart from the ESXi menu. This is my BOOT.cfg

    bootstate=0
    title=Loading ESXi installer
    kernelopt=runweasel cdromBoot ks=cdrom:/KS/KS3.CFG +++
    kernelopt=runweasel cdromBoot ks=cdrom:/KS/KS2.CFG +++
    kernelopt=runweasel cdromBoot ks=cdrom:/KS/KS1.CFG +++
    timeout=5
    prefix=
    kernel=/b.b00
    kernelopt=runweasel cdromBoot
    modules=/jumpstrt.gz --- /useropts.gz --- /features.gz --- /k.b00 --- /uc_intel.b00 --- /uc_amd.b00 --- /uc_hygon.b00 --- /procfs.b00 --- /vmx.v00 --- /vim.v00 --- /tpm.v00 --- /sb.v00 --- /s.v00 --- /atlantic.v00 --- /bnxtnet.v00 --- /bnxtroce.v00 --- /brcmfcoe.v00 --- /elxiscsi.v00 --- /elxnet.v00 --- /i40en.v00 --- /iavmd.v00 --- /icen.v00 --- /igbn.v00 --- /ionic_en.v00 --- /irdman.v00 --- /iser.v00 --- /ixgben.v00 --- /lpfc.v00 --- /lpnic.v00 --- /lsi_mr3.v00 --- /lsi_msgp.v00 --- /lsi_msgp.v01 --- /lsi_msgp.v02 --- /mtip32xx.v00 --- /ne1000.v00 --- /nenic.v00 --- /nfnic.v00 --- /nhpsa.v00 --- /nmlx4_co.v00 --- /nmlx4_en.v00 --- /nmlx4_rd.v00 --- /nmlx5_co.v00 --- /nmlx5_rd.v00 --- /ntg3.v00 --- /nvme_pci.v00 --- /nvmerdma.v00 --- /nvmetcp.v00 --- /nvmxnet3.v00 --- /nvmxnet3.v01 --- /pvscsi.v00 --- /qcnic.v00 --- /qedentv.v00 --- /qedrntv.v00 --- /qfle3.v00 --- /qfle3f.v00 --- /qfle3i.v00 --- /qflge.v00 --- /rste.v00 --- /sfvmk.v00 --- /smartpqi.v00 --- /vmkata.v00 --- /vmkfcoe.v00 --- /vmkusb.v00 --- /vmw_ahci.v00 --- /bmcal.v00 --- /crx.v00 --- /elx_esx_.v00 --- /btldr.v00 --- /esx_dvfi.v00 --- /esx_ui.v00 --- /esxupdt.v00 --- /tpmesxup.v00 --- /weaselin.v00 --- /esxio_co.v00 --- /loadesx.v00 --- /lsuv2_hp.v00 --- /lsuv2_in.v00 --- /lsuv2_ls.v00 --- /lsuv2_nv.v00 --- /lsuv2_oe.v00 --- /lsuv2_oe.v01 --- /lsuv2_oe.v02 --- /lsuv2_sm.v00 --- /native_m.v00 --- /qlnative.v00 --- /trx.v00 --- /vdfs.v00 --- /vmware_e.v00 --- /vsan.v00 --- /vsanheal.v00 --- /vsanmgmt.v00 --- /tools.t00 --- /xorg.v00 --- /gc.v00 --- /imgdb.tgz --- /basemisc.tgz --- /resvibs.tgz --- /imgpayld.tgz
    build=7.0.3-0.95.21930508
    updated=0

    when i boot this iso in UEFI mode, it go direct to the install and not

    Reply
    • William Lam says

      12/05/2024 at 8:26 am

      You need to edit the actual EFI boot.cfg which is located under EFI directory 🙂

      Reply
      • *protectedTony says

        12/10/2024 at 8:53 am

        I tried this BOOT.CFG under /EFI/BOOT

        bootstate=0
        title=Loading ESXi installer
        kernelopt=runweasel cdromBoot ks=cdrom:/KS/TEST10.CFG +++
        kernelopt=runweasel cdromBoot ks=cdrom:/KS/TEST9.CFG +++
        kernelopt=runweasel cdromBoot ks=cdrom:/KS/TEST8.CFG +++
        kernelopt=runweasel cdromBoot ks=cdrom:/KS/TEST7.CFG +++
        kernelopt=runweasel cdromBoot ks=cdrom:/KS/TEST6.CFG +++
        kernelopt=runweasel cdromBoot ks=cdrom:/KS/TEST5.CFG +++
        kernelopt=runweasel cdromBoot ks=cdrom:/KS/TEST4.CFG +++
        kernelopt=runweasel cdromBoot ks=cdrom:/KS/TEST3.CFG +++
        kernelopt=runweasel cdromBoot ks=cdrom:/KS/TEST2.CFG +++
        kernelopt=runweasel cdromBoot ks=cdrom:/KS/TEST1.CFG +++
        timeout=5
        prefix=
        kernel=/b.b00
        kernelopt=runweasel cdromBoot
        modules=/jumpstrt.gz --- /useropts.gz --- /features.gz --- /k.b00 --- /uc_intel.b00 --- /uc_amd.b00 --- /uc_hygon.b00 --- /procfs.b00 --- /vmx.v00 --- /vim.v00 --- /tpm.v00 --- /sb.v00 --- /s.v00 --- /atlantic.v00 --- /bnxtnet.v00 --- /bnxtroce.v00 --- /brcmfcoe.v00 --- /elxiscsi.v00 --- /elxnet.v00 --- /i40en.v00 --- /iavmd.v00 --- /icen.v00 --- /igbn.v00 --- /ionic_en.v00 --- /irdman.v00 --- /iser.v00 --- /ixgben.v00 --- /lpfc.v00 --- /lpnic.v00 --- /lsi_mr3.v00 --- /lsi_msgp.v00 --- /lsi_msgp.v01 --- /lsi_msgp.v02 --- /mtip32xx.v00 --- /ne1000.v00 --- /nenic.v00 --- /nfnic.v00 --- /nhpsa.v00 --- /nmlx4_co.v00 --- /nmlx4_en.v00 --- /nmlx4_rd.v00 --- /nmlx5_co.v00 --- /nmlx5_rd.v00 --- /ntg3.v00 --- /nvme_pci.v00 --- /nvmerdma.v00 --- /nvmetcp.v00 --- /nvmxnet3.v00 --- /nvmxnet3.v01 --- /pvscsi.v00 --- /qcnic.v00 --- /qedentv.v00 --- /qedrntv.v00 --- /qfle3.v00 --- /qfle3f.v00 --- /qfle3i.v00 --- /qflge.v00 --- /rste.v00 --- /sfvmk.v00 --- /smartpqi.v00 --- /vmkata.v00 --- /vmkfcoe.v00 --- /vmkusb.v00 --- /vmw_ahci.v00 --- /bmcal.v00 --- /crx.v00 --- /elx_esx_.v00 --- /btldr.v00 --- /esx_dvfi.v00 --- /esx_ui.v00 --- /esxupdt.v00 --- /tpmesxup.v00 --- /weaselin.v00 --- /esxio_co.v00 --- /loadesx.v00 --- /lsuv2_hp.v00 --- /lsuv2_in.v00 --- /lsuv2_ls.v00 --- /lsuv2_nv.v00 --- /lsuv2_oe.v00 --- /lsuv2_oe.v01 --- /lsuv2_oe.v02 --- /lsuv2_sm.v00 --- /native_m.v00 --- /qlnative.v00 --- /trx.v00 --- /vdfs.v00 --- /vmware_e.v00 --- /vsan.v00 --- /vsanheal.v00 --- /vsanmgmt.v00 --- /tools.t00 --- /xorg.v00 --- /gc.v00 --- /imgdb.tgz --- /basemisc.tgz --- /resvibs.tgz --- /imgpayld.tgz
        build=7.0.3-0.95.21930508
        updated=0

        but its not booting into the ISO. Its going directly to ESXi installer.

        This is how I generated the iso

        genisoimage -o /output/{{ custom_iso_name }} \
        -b ISOLINUX.BIN -c BOOT.CAT -no-emul-boot \
        -boot-load-size 4 -boot-info-table \
        -eltorito-alt-boot -e EFIBOOT.IMG -no-emul-boot \
        /input/"

        any help appreciated.

        Thanks

        Reply
        • William Lam says

          12/10/2024 at 9:36 am

          I believe you've also posted on the VMware Communities, as I've already responded there, please see this community thread for details you're looking for https://community.broadcom.com/vmware-cloud-foundation/discussion/has-anyone-been-able-to-invoke-the-vmware-bootx64efi-from-a-bootx64efi-grubefi-menu

          Reply

Leave a Reply to Varun KumarCancel reply

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

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Automating the vSAN Data Migration Pre-check using vSAN API 06/04/2025
  • VCF 9.0 Hardware Considerations 05/30/2025
  • VMware Flings is now available in Free Downloads of Broadcom Support Portal (BSP) 05/19/2025
  • VMUG Connect 2025 - Minimal VMware Cloud Foundation (VCF) 5.x in a Box  05/15/2025
  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025

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 © 2025