Home / Software-Defined / Compute (VMware) / Deploy ESXi 6.5 from USB stick and unattended file

Deploy ESXi 6.5 from USB stick and unattended file

VMware ESXi 6.5 has been released last month and I decide to share with you how I have deployed ESXi 6.5 from a USB stick and with an unattend file. There is no major new feature with ESXi 6.5 related to deployment from unattended file. But I decide to build a vSphere lab and deploy ESXi node without a click.

This topic shows you how to prepare a USB stick and an unattend file to deploy nearly automatically ESXi 6.5.

Architecture overview

In order that the following deployment works, I have done some configurations from a network perspective. I have configured the following:

  • DHCP Server
  • DNS Server (forward and reverse lookup zone)

The network address space is In the DHCP server configuration, I have set a static IP for both ESXi:

Below you can find the forward lookup zone configuration in the Synology:

And below, you can find the reverse lookup zone:

Thanks to this configuration, the ESXi will obtain its production IP address (in DHCP) and its hostname from the reverse lookup zone during deployment. Then by using a script, the IP address has just to be set from DHCP to static.


To follow this topic, you need the following:

  • An USB stick with 8GB at least
  • Rufus to prepare the USB stick
  • ISO of VMware ESXi 6.5

Prepare the USB stick

To prepare the USB stick, plug it into your computer and run Rufus. This software is portable. Select the ISO image of ESXi 6.5 and set Rufus as the following screenshot:

If you have the following message when you start the format, just click on Yes.

Build the unattend file

To deploy my ESXi, I have used the following script. You can find an explanation in the comments. This script can be used for each ESXi to deploy while the static IP in DHCP and DNS are set.

#Accept VMware License agreement


# Set the root password

rootpw MyPassword

# Install ESXi on the first disk (Local first, then remote then USB)

install --firstdisk --overwritevmfs

# Set the keyboard

keyboard French

# Set the network

network --bootproto=dhcp

# reboot the host after installation is completed


# run the following command only on the firstboot

%firstboot --interpreter=busybox

# enable & start remote ESXi Shell (SSH)

vim-cmd hostsvc/enable_ssh

vim-cmd hostsvc/start_ssh

# enable & start ESXi Shell (TSM)

vim-cmd hostsvc/enable_esx_shell

vim-cmd hostsvc/start_esx_shell

# supress ESXi Shell shell warning - Thanks to Duncan (http://www.yellow-bricks.com/2011/07/21/esxi-5-suppressing-the-localremote-shell-warning/)

esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 1

# Get Network adapter information


# Get the IP address assigned by DHCP

IPAddress=$(localcli network ip interface ipv4 get | grep "${NetName}" | awk '{print $2}')

#Get the netmask assigned by DHCP

NetMask=$(localcli network ip interface ipv4 get | grep "${NetName}" | awk '{print $3}')

# Get the gateway provided by DHCP

Gateway=$(localcli network ip interface ipv4 get | grep "${NetName}" | awk '{print $6}')



# Get the hostname assigned thanks to reverse lookup zone

HostName=$(hostname -s)



# set static IP + default route + DNS

esxcli network ip interface ipv4 set --interface-name=vmk0 --ipv4=${IPAddress} --netmask=${NetMask} --type=static --gateway=${Gateway}

esxcli network ip dns server add --server ${DNS}


esxcli network vswitch standard portgroup set --portgroup-name "Management Network" --vlan-id 50

#Disable ipv6

esxcli network ip set --ipv6-enabled=0

# set suffix and FQDN host configuration

esxcli system hostname set --fqdn=${FQDN}

esxcli network ip dns search add --domain=${SuffixDNS}

# NTP Configuration (thanks to http://www.virtuallyghetto.com)

cat > /etc/ntp.conf << __NTP_CONFIG__

restrict default kod nomodify notrap noquerynopeer


server 0.fr.pool.ntp.org

server 1.fr.pool.ntp.org


/sbin/chkconfig ntpd on

# rename local datastore to something more meaningful

vim-cmd hostsvc/datastore/rename datastore1 "Local - $(hostname -s)"

# restart a last time


Save the file and name it ks.cfg. Copy the file in the root of the USB stick.

Use the unattend file during deployment

Now we have to configure the boot the load the ks.cfg automatically for the deployment. Open the USB stick and edit Boot.cfg. Replace the following line kernelopt=runweasel by kernelopt=ks=usb:/ks.cfg.

Unplug the USB Stick and plug it on the server. You can boot the USB key to run the installer.


During deployment, the installer will load the ks.cfg config file.

It starts by check if the config file is correct.

After the first reboot, the installer configures the ESXi as specified in the config file.

Once the system has rebooted for a second time, the configuration is finished.

For example, the SSH and the ESXi Shell are well enabled.


VMware provides a way to deploy quickly standard ESXi. If your infrastructure is not ready and you have not yet Auto Deploy, the deployment with unattended file can be a good option.

About Romain Serre

Romain Serre works in Lyon as a Senior Consultant. He is focused on Microsoft Technology, especially on Hyper-V, System Center, Storage, networking and Cloud OS technology as Microsoft Azure or Azure Stack. He is a MVP and he is certified Microsoft Certified Solution Expert (MCSE Server Infrastructure & Private Cloud), on Hyper-V and on Microsoft Azure (Implementing a Microsoft Azure Solution).

Leave a Reply

Your email address will not be published. Required fields are marked *



Check Also

Connect vSphere 6.5 to iSCSI storage NAS

When you implement ESXi cluster, you need also a shared storage to store the virtual ...

Deploy a converged network with vSphere 6.5

With the increased network card rates, we are now able to let several flows pass ...

Step-by-Step: Deploy vCenter Server Appliance (VCSA) 6.5

VMware vCenter is a management software for your vSphere environment. It enables to manage from ...