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 / How to prevent physical CD-ROM from ejecting after installing or upgrading ESXi?

How to prevent physical CD-ROM from ejecting after installing or upgrading ESXi?

07.15.2019 by William Lam // Leave a Comment

While catching up on some news over the weekend, I had noticed a VMware Reddit thread asking a pretty interesting question on how to prevent the physical CD-ROM tray from ejecting after installing or upgrading ESXi? This behavior occurs whether you are using a physical CD-ROM media or a "Virtual" ISO image via an out-of-band interface like an iDRAC or iLO. If you are automating the installation or upgrade using Auto Deploy or network installation such as Kickstart, this is not a problem.

However, I was a bit surprised to hear that this was still a pain point in 2019, as many of the new servers in market do not even include an option for CD-ROM. Some of the suggestions really brought me back to the early 2000's including physically taping up the CD-DROM tray, which I have definitely seen customers doing but this is not a scalable solution and it requires a visit to the datacenter. 

One easy solution that I had suggested was to take advantage of ESXi's scripted installation capability also known as Kickstart and use the supported ESXi --noeject option after reboot. Since the install/upgrade was being done manually, the added benefit of this solution is that you can now have it automated 🙂 The other nice thing about this option is that you can specify the kickstart using the default ESXi ISO or you can take it a step further and embed the Kickstart with a custom ESXi ISO.

Step 1 - Here is a sample Kickstart which includes the --noeject command as part of the reboot option. Simply host ks.cfg on an internal webserver which is accessible by the ESXi host that is being installed and/or upgraded. 

vmaccepteula
install --firstdisk=local --overwritevmfs
reboot --noeject

network --bootproto=static --ip=192.168.30.99 --netmask=255.255.255.0 --gateway=192.168.30.1 --hostname=noeject-esxi.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

Step 2 - Boot the ESXi ISO like you normally would but edit the boot option (Shift+O) and replace it with the following: ks=https://[SERVER]/ks.cfg and then hit enter for installation and/or upgrade to automatically start.


Once the installation has finished, the ESXi host will automatically reboot and the CD-ROM tray will not be ejected.

Since I did not have a physical host with CD-ROM, I was able to validate this by simply using a Nested ESXi VM and as you can see, the CD-ROM device is still "Connected" after installation.


If we install or upgrade ESXi normally via the ISO image, you will see the CD-ROM device is automatically "Disconnected" afterwards which is the equivalent of ejecting the physical CD-ROM tray.

More from my site

  • Automated ESXi Installation to USB using Kickstart
  • 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?
  • How to create custom ESXi boot menu to support multiple Kickstart files?
  • How to automate VM deployment from large USB keys using ESXi Kickstart?

Categories // Automation, ESXi Tags // cdrom, ESXi, kickstart, ks.cfg, noeject

Thanks for the comment!Cancel 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

  • Crowdsourced Lab Hardware for ESXi 9.0 Dashboard 06/17/2025
  • 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

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

 

Loading Comments...