You can use a default script to perform a standard ESXi installation to the first detected disk.

During an ESXi installation, you can use a default script to perform a standard installation to the first detected disk, and the boot loader configuration file to specify the kernel, the kernel options, and the boot modules that the mboot.c32 or mboot.efi boot loader uses for the installation.

About the Default ks.cfg Installation Script

The ESXi installer includes a default installation script that performs a standard installation to the first detected disk.

The default ks.cfg installation script is located in the initial RAM disk at /etc/vmware/weasel/ks.cfg. You can specify the location of the default ks.cfg file with the ks=file://etc/vmware/weasel/ks.cfg boot option. See Enter Boot Options to Run an Installation or Upgrade Script.

When you install ESXi using the ks.cfg script, the default root password is myp@ssw0rd.

You cannot modify the default script on the installation media. After the installation, you can use the vSphere Client to log in to the vCenter Server that manages the ESXi host and modify the default settings.

With vSphere 8.0, if your system has data processing units (DPU), you use the ks.cfg script also to install ESXi on DPUs.

The default script contains the following commands:

#
# Sample scripted installation file
#

# Accept the VMware End User License Agreement
vmaccepteula

# Set the root password for the DCUI and Tech Support Mode
rootpw myp@ssw0rd

# Install on the first local disk available on machine
install --firstdisk --overwritevmfs
 In case you system has DPUs, you also specify a PCI slot:
install --firstdisk --overwritevmfs --dpupcislots=<PCIeSlotID>

# Set the network to DHCP on the first network adapter
network --bootproto=dhcp --device=vmnic0

# A sample post-install script
%post --interpreter=python --ignorefailure=true
import time
stampFile = open('/finished.stamp', mode='w')
stampFile.write( time.asctime() )

About the boot.cfg File

The boot loader configuration file boot.cfg specifies the kernel, the kernel options, and the boot modules that the mboot.c32 or mboot.efi boot loader uses in an ESXi installation.

The boot.cfg file is provided in the ESXi installer. You can modify the kernelopt line of the boot.cfg file to specify the location of an installation script or to pass other boot options.

The boot.cfg file has the following syntax:
# boot.cfg -- mboot configuration file
#
# Any line preceded with '#' is a comment.

title=STRING
prefix=DIRPATH
kernel=FILEPATH
kernelopt=STRING
modules=FILEPATH1 --- FILEPATH2... --- FILEPATHn

# Any other line must remain unchanged.

The commands in boot.cfg configure the boot loader.

Table 1. Commands in boot.cfg.
Command Description
title=STRING Sets the boot loader title to STRING.
prefix=STRING (Optional) AddsDIRPATH/ in front of every FILEPATH in the kernel= and modules= commands that do not already start with / or with http://.
kernel=FILEPATH Sets the kernel path to FILEPATH.
kernelopt=STRING Appends STRING to the kernel boot options.
modules=FILEPATH1 --- FILEPATH2... --- FILEPATHn Lists the modules to be loaded, separated by three hyphens (---).

See Create an Installer ISO Image with a Custom Installation or Upgrade Script and Network Booting the ESXi Installer.

Locations Supported for Installation or Upgrade Scripts

In scripted installations and upgrades, the ESXi installer can access the installation or upgrade script, also called the kickstart file, from several locations.

The following locations are supported for the installation or upgrade script:

Path to the Installation or Upgrade Script

You can specify the path to an installation or upgrade script.

ks=http://XXX.XXX.XXX.XXX/kickstart/KS.CFG is the path to the ESXi installation script, where XXX.XXX.XXX.XXX is the IP address of the machine where the script resides. See Installing ESXi by Using a Script.

To start an installation script from an interactive installation, you enter the ks= option manually. See Enter Boot Options to Run an Installation or Upgrade Script.

Installation and Upgrade Script Commands

To modify the default installation or upgrade script or to create your own script, use supported commands. Use supported commands in the installation script, which you specify with a boot command when you boot the installer.

To determine which disk to install or upgrade ESXi on, the installation script requires one of the following commands: install, upgrade, or installorupgrade. The install command creates the default partitions, including a VMFS datastore that occupies all available space after the other partitions are created.

With vSphere 8.0, if your system has supported data processing units (DPU), always consider the installation, re-installation or upgrade of ESXi on the DPUs along with ESXi on hosts. ESXi update and upgrade on DPUs is not supported by the interactive or scripted method, you can only use vSphere Lifecycle Manager.

Note: The use of SD and USB devices for storing ESX-OSData partitions is being deprecated. You can use SD and USB devices only to create boot bank partitions, boot-bank 0 and boot-bank 1. Additionally, you can provide a persistent disk of minimum 32 GB on which to install the ESX-OSData partition. You define such disks by using the parameter systemDisk in the install command.

accepteula or vmaccepteula (Required)

Accepts the ESXi license agreement.

clearpart (Optional)

Clears any existing partitions on the disk. Requires the install command to be specified. Carefully edit the clearpart command in your existing scripts.

--drives=
Remove partitions on the specified drives.
--alldrives
Ignores the --drives= requirement and allows clearing of partitions on every drive.
--ignoredrives=
Removes partitions on all drives except those specified. Required unless the --drives= or --alldrives flag is specified.
--overwritevmfs
Allows overwriting of VMFS partitions on the specified drives. By default, overwriting VMFS partitions is not allowed.
--firstdisk=
disk-type1
[disk-type2,...]
Note: If your vSphere system is of version earlier than 8.0 Update 3 and has DPUs, you also specify a PCI slot: : install --firstdisk --overwritevmfs --dpupcislots=<PCIeSlotID>. For systems of version 8.0 Update 3 and later, the dpupcislots parameter is deprecated.
Partitions the first eligible disk found. By default, the eligible disks are set to the following order:
  1. Locally attached storage (local)
  2. Network storage (remote)

You can change the order of the disks by using a comma-separated list appended to the argument. If you provide a filter list, the default settings are overridden. You can combine filters to specify a particular disk, including esx for the first disk with ESXi installed on it, model and vendor information, or the name of the VMkernel device driver. For example, to prefer a disk with the model name ST3120814A and any disk that uses the mptsas driver rather than a normal local disk, the argument is --firstdisk=ST3120814A,mptsas,local. You can use localesx for local storage that contains ESXi image or remoteesx for remote storage that contains ESXi image.

dryrun (Optional)

Parses and checks the installation script. Does not perform the installation.

install

Specifies that this is a fresh installation. Either the install, upgrade, or installorupgrade command is required to determine which disk to install or upgrade ESXi on.

--disk= or --drive=
Specifies the disk to partition. In the command --disk=diskname, the diskname can be a disk name or a full disk filesystem path in ESXi, for example:
  • Disk name: --disk=naa.6d09466044143600247aee55ca2a6405 or
  • Device path: --disk=/vmfs/devices/disks/mpx.vmhba1:C0:T0:L0

For accepted disk name formats, see Disk Device Names.

--firstdisk=
disk-type1,
[ disk-type2,...]
Note: If your vSphere system is of version earlier than 8.0 Update 3 and has DPUs, you also specify a PCI slot: : install --firstdisk --overwritevmfs --dpupcislots=<PCIeSlotID>. For systems of version 8.0 Update 3 and later, the dpupcislots parameter is deprecated.
Partitions the first eligible disk found. By default, the eligible disks are set to the following order:
  1. Locally attached storage (local)
  2. Network storage (remote)

You can change the order of the disks by using a comma-separated list appended to the argument. If you provide a filter list, the default settings are overridden. You can combine filters to specify a particular disk, including esx for the first disk with ESX installed on it, model and vendor information, or the name of the VMkernel device driver. For example, to prefer a disk with the model name ST3120814A and any disk that uses the mptsas driver rather than a normal local disk, the argument is --firstdisk=ST3120814A,mptsas,local. You can use localesx for local storage that contains ESXi image or remoteesx for remote storage that contains ESXi image.

--ignoressd
Excludes solid-state disks from eligibility for partitioning. This option can be used with the install command and the --firstdisk option. This option takes precedence over the --firstdisk option. This option is invalid with the --drive or --disk options and with the upgrade and installorupgrade commands. See the vSphere Storage documentation for more information about preventing SSD formatting during auto-partitioning.
--overwritevsan
You must use the --overwritevsan option when you install ESXi on a disk, either SSD or HDD (magnetic), that is in a vSAN disk group. If you use this option and no vSAN partition is on the selected disk, the installation fails. When you install ESXi on a disk that is in vSAN disk group, the result depends on the disk that you select:
  • If you select an SSD, the SSD and all underlying HDDs in the same disk group is wiped.
  • If you select an HDD, and the disk group size is greater than two, only the selected HDD is wiped.
  • If you select an HDD disk, and the disk group size is two or less, the SSD and the selected HDD is wiped.

For more information about managing vSAN disk groups, see the vSphere Storage documentation.

--overwritevmfs
Required to overwrite an existing VMFS datastore on the disk before installation.
--preservevmfs
Preserves an existing VMFS datastore on the disk during installation.
--novmfsondisk
Prevents a VMFS partition from being created on this disk. Must be used with --overwritevmfs if a VMFS partition exists on the disk.
--systemdisk
If you use an USB or SD device, systemDisk specifies local persistent disk on which to install the ESX-OSData partition. For example, install --firstdisk = usb --systemDisk=<diskID>. As a result, boot bank partitions are placed on the USB device, while the OSData partition is on the disk specified in the systemDisk parameter.
--repartitionsystemdisk
If you use an USB or SD device and the local disk that you specify with the systemDisk parameter is not empty or contains a datastore, you can use repartitionSystemDisk to make sure that the persistent disk is repartitioned before use.
Note: If a local persistent disk is not available or the disk size is less than 32GB, you see warning messages, but installation continues.
--forceunsupportedinstall

Blocks the installation of deprecated CPUs.

installorupgrade

Either the install, upgrade, or installorupgrade command is required to determine which disk to install or upgrade ESXi on.

--disk= or --drive=
Specifies the disk to partition. In the command --disk=diskname, the diskname can be a disk name or a full disk filesystem path in ESXi, for example:
  • Disk name: --disk=naa.6d09466044143600247aee55ca2a6405 or
  • Device path: --disk=/vmfs/devices/disks/mpx.vmhba1:C0:T0:L0

For accepted disk name formats, see Disk Device Names.

--firstdisk=
disk-type1,
[ disk-type2,...]
Note: If your vSphere system is of version earlier than 8.0 Update 3 and has DPUs, you also specify a PCI slot: : install --firstdisk --overwritevmfs --dpupcislots=<PCIeSlotID>. For systems of version 8.0 Update 3 and later, the dpupcislots parameter is deprecated.
Partitions the first eligible disk found. By default, the eligible disks are set to the following order:
  1. Locally attached storage (local)
  2. Network storage (remote)

You can change the order of the disks by using a comma-separated list appended to the argument. If you provide a filter list, the default settings are overridden. You can combine filters to specify a particular disk, including esx for the first disk with ESX installed on it, model and vendor information, or the name of the VMkernel device driver. For example, to prefer a disk with the model name ST3120814A and any disk that uses the mptsas driver rather than a normal local disk, the argument is --firstdisk=ST3120814A,mptsas,local. You can use localesx for local storage that contains ESXi image or remoteesx for remote storage that contains ESXi image.

--overwritevsan
You must use the --overwritevsan option when you install ESXi on a disk, either SSD or HDD (magnetic), that is in a vSAN disk group. If you use this option and no vSAN partition is on the selected disk, the installation fails. When you install ESXi on a disk that is in a vSAN disk group, the result depends on the disk that you select:
  • If you select an SSD, the SSD and all underlying HDDs in the same disk group is wiped.
  • If you select an HDD, and the disk group size is greater than two, only the selected HDD is wiped.
  • If you select an HDD disk, and the disk group size is two or less, the SSD and the selected HDD is wiped.

For more information about managing vSAN disk groups, see the vSphere Storage documentation.

--overwritevmfs

Install ESXi if a VMFS partition exists on the disk, but no ESX or ESXi installation exists. Unless this option is present, the installer fails if a VMFS partition exists on the disk, but an ESX or ESXi installation is missing.

keyboard (Optional)

Sets the keyboard type for the system.

keyboardType
Specifies the keyboard map for the selected keyboard type. keyboardType must be one of the following types.
  • Belgian
  • Brazilian
  • Croatian
  • Czechoslovakian
  • Danish
  • Estonian
  • Finnish
  • French
  • German
  • Greek
  • Icelandic
  • Italian
  • Japanese
  • Latin American
  • Norwegian
  • Polish
  • Portuguese
  • Russian
  • Slovenian
  • Spanish
  • Swedish
  • Swiss French
  • Swiss German
  • Turkish
  • Ukrainian
  • United Kingdom
  • US Default
  • US Dvorak

serialnum or vmserialnum (Optional)

The command is supported in ESXi version 5.1 and later. Configures licensing. If not included, ESXi installs in evaluation mode.

--esx=<license-key>

Specifies the vSphere license key to use. The format is 5 five-character groups (XXXXX-XXXXX-XXXXX-XXXXX-XXXXX).

network (Optional)

Specifies a network address for the system.

--bootproto=[dhcp|static]

Specifies whether to obtain the network settings from DHCP or set them manually.

--device=
Specifies either the MAC address of the network card or the device name, in the form vmnicNN, as in vmnic0. This option refers to the uplink device for the virtual switch.
--ip=
Sets an IP address for the machine to be installed, in the form xxx.xxx.xxx.xxx. Required with the --bootproto=static option and ignored otherwise.
--gateway=
Designates the default gateway as an IP address, in the form xxx.xxx.xxx.xxx. Used with the --bootproto=static option.
--nameserver=
Designates the primary name server as an IP address. Used with the --bootproto=static option. Omit this option if you do not intend to use DNS.

The --nameserver option can accept two IP addresses. For example: --nameserver="10.126.87.104[,10.126.87.120]"

--netmask=
Specifies the subnet mask for the installed system, in the form 255.xxx.xxx.xxx. Used with the --bootproto=static option.
--hostname=
Specifies the host name for the installed system.
--vlanid= vlanid
Specifies which VLAN the system is on. Used with either the --bootproto=dhcp or --bootproto=static option. Set to an integer from 1 to 4096.
--addvmportgroup=(0|1)
Specifies whether to add the VM Network port group, which is used by virtual machines. The default value is 1.

paranoid (Optional)

Causes warning messages to interrupt the installation. If you omit this command, warning messages are logged.

part or partition (Optional)

Creates an extra VMFS datastore on the system. Only one datastore per disk can be created. Cannot be used on the same disk as the install command. Only one partition can be specified per disk and it can only be a VMFS partition.

datastore name
Specifies where the partition is to be mounted.
--ondisk= or --ondrive=
Specifies the disk or drive where the partition is created.
--onfirstdisk=
disk-type1,
[ disk-type2,...]
Note: If your vSphere system is of version earlier than 8.0 Update 3 and has DPUs, you also specify a PCI slot: : install --firstdisk --overwritevmfs --dpupcislots=<PCIeSlotID>. For systems of version 8.0 Update 3 and later, the dpupcislots parameter is deprecated.
Partitions the first eligible disk found. By default, the eligible disks are set to the following order:
  1. Locally attached storage (local)
  2. Network storage (remote)

You can change the order of the disks by using a comma-separated list appended to the argument. If you provide a filter list, the default settings are overridden. You can combine filters to specify a particular disk, including esx for the first disk with ESX installed on it, model and vendor information, or the name of the VMkernel device driver. For example, to prefer a disk with the model name ST3120814A and any disk that uses the mptsas driver rather than a normal local disk, the argument is --onfirstdisk=ST3120814A,mptsas,local. You can use localesx for local storage that contains ESXi image or remoteesx for remote storage that contains ESXi image.

reboot (Optional)

Reboots the machine after the scripted installation is complete.

<--noeject>
The CD is not ejected after the installation.

rootpw (Required)

Sets the root password for the system.

--iscrypted
Specifies that the password is encrypted.
password
Specifies the password value.

upgrade

Either the install, upgrade, or installorupgrade command is required to determine which disk to install or upgrade ESXi on.

--disk= or --drive=
Specifies the disk to partition. In the command --disk=diskname, the diskname can be a disk name or a full disk filesystem path in ESXi, for example:
  • Disk name: --disk=naa.6d09466044143600247aee55ca2a6405 or
  • Device path: --disk=/vmfs/devices/disks/mpx.vmhba1:C0:T0:L0

For accepted disk name formats, see Disk Device Names.

--firstdisk=
disk-type1,
[ disk-type2,...]
Partitions the first eligible disk found. By default, the eligible disks are set to the following order:
  1. Locally attached storage (local)
  2. Network storage (remote)

You can change the order of the disks by using a comma-separated list appended to the argument. If you provide a filter list, the default settings are overridden. You can combine filters to specify a particular disk, including esx for the first disk with ESX installed on it, model and vendor information, or the name of the VMkernel device driver. For example, to prefer a disk with the model name ST3120814A and any disk that uses the mptsas driver rather than a normal local disk, the argument is --firstdisk=ST3120814A,mptsas,local. You can use localesx for local storage that contains ESXi image or remoteesx for remote storage that contains ESXi image.

%include or include (Optional)

Specifies another installation script to parse. This command is treated similarly to a multiline command, but takes only one argument.

filename
For example: %include part.cfg

%pre (Optional)

Specifies a script to run before the kickstart configuration is evaluated. For example, you can use it to generate files for the kickstart file to include.

--interpreter
=[python|busybox]
Specifies an interpreter to use. The default is busybox.

%post (Optional)

Runs the specified script after package installation is complete. If you specify multiple %post sections, they run in the order that they appear in the installation script.

--interpreter
=[python|busybox]
Specifies an interpreter to use. The default is busybox.
--timeout=secs
Specifies a timeout for running the script. If the script is not finished when the timeout expires, the script is forcefully stopped.
--ignorefailure
=[true|false]
If true, the installation is considered a success even if the %post script stops with an error.

%firstboot

Creates an init script that runs only during the first boot. The script has no effect on subsequent boots. If multiple %firstboot sections are specified, they run in the order that they appear in the kickstart file.

Note: You cannot check the semantics of %firstboot scripts until the system is booting for the first time. A %firstboot script might contain potentially catastrophic errors that are not exposed until after the installation is complete.
Important: The %firstboot script does not run, if secure boot is enabled on the ESXi host.
--interpreter
=[python|busybox]
Specifies an interpreter to use. The default is busybox.
Note: You cannot check the semantics of the %firstboot script until the system boots for the first time. If the script contains errors, they are not exposed until after the installation is complete.

Disk Device Names

The install, upgrade, and installorupgrade installation script commands require the use of disk device names.

Table 2. Disk Device Names
Format Example Description
NAA naa.6d09466044143600247aee55ca2a6405 SCSI INQUIRY identifier
EUI eui.3966623838646463 SCSI INQUIRY identifier
T10 t10.SanDisk00Cruzer_Blade000000004C530001171118101244 SCSI INQUIRY identifier
VML vml.00025261 Legacy VMkernel identifier
MPX mpx.vmhba0:C0:T0:L0 Path-based identifier

For more information on storage device names, see Storage Device Names and Identifiers in the vSphere Storage documentation.