VMFS Recovery™
Recover data from damaged or formatted VMFS disks or VMDK files
Recover data from damaged or formatted VMFS disks or VMDK files
Last updated: Jan 26, 2024

ESXCLI commands: What are they?

Here you will find out:

  • whether ESXi has its own ESXCLI commands or not
  • what ESXCLI commands are
  • how DiskInternals software can help you

Are you ready? Let's read!

If you live and breathe command lines, you presumably already know how to use esxcli commands to administer and configure ESXi. On the other hand, this piece should be helpful if you are unfamiliar with the esxcli system. All you need to know for the time being is that esxcli commands are executed from the ESXi shell.

ESXi Shell and ESXCLI

Before you can proceed, you must enable the ESXi shell, which is typically turned off as a security measure. To do this, refer to Knowledge Base (KB) article 2004746 for detailed activation instructions. Once the shell is enabled, you can use a client application such as PuTTY to establish an SSH connection to the shell.

Alternatively, if you're at the Direct Console User Interface (DCUI), the shell can be accessed by pressing ALT-F1. To execute commands in the shell, you'll need to log in as the 'root' user or with an account that has similar privileges. For a deeper dive into ESXi and to manipulate the esxcli system fully, you can perform queries on the available namespaces using the 'esxcli' command list. The table below provides explanations for each of the namespaces available on ESXi, sourced from VMware. For information on namespaces in previous versions of ESXi, consult the corresponding web documentation or run 'esxcli' with no arguments.

Here are some of the most frequently used commands:

esxcli deviceLists descriptions of device commands.
esxcli esxcliLists descriptions of esxcli commands.
esxcli fcoeFCOE (Fibre Channel over Ethernet) comands
esxcli graphicsGraphics commands
esxcli hardwareHardware namespace. Used primarily for extracting information about the current system setup.
esxcli iscsiiSCSI namespace for monitoring and managing hardware and software iSCSI.
esxcli networkNetwork namespace for managing virtual networking including virtual switches and VMkernel network interfaces.
esxcli nvmeCommands for managing NVMe devices.
esxcli rdmaCommands for monitoring RDMA devices.
esxcli schedManage the shared system-wide swap space.
esxcli softwareSoftware namespace. Includes commands for managing and installing image profiles and VIBs.
esxcli storageIncludes core storage commands and other storage management commands.
esxcli systemSystem monitoring and management command.
esxcli vmNamespace for listing virtual machines and shutting them down forcefully.
esxcli vsanNamespace for vSAN management commands. See the vSphere Storage publication for details.

The Top 20 ESXCLI Commands

Below, listed by namespace, is a collection of the esxcli commands for vSphere that I commonly use. It is not a complete list since there are too many to include. If you want the full scoop, head over to VMware's documentation page.

System related commands

#1: esxcli system version get

Description: Returns the ESXi build and version numbers.

#2: esxcli system hostname get

Description: Returns the hostname, domain and FQDN for the host.

#3: esxcli system stats installtime get

Description: Returns the date and time of when ESXi was installed.

#4: esxcli system account list

Description: Lists the local users created on the ESXi host.

#5: esxcli system account add -d ‘Altaro Guest’ -i altaro -p dsfewfewf*3!4404 -c dsfe

Description: This command allows you to create local ESXi users. All the parameters used in the ESXI host example are mandatory.

#6: esxcli system maintenanceMode set –enable true

Description: Use this command to put ESXi in maintenance mode or take it out.

#7: esxcli system shutdown reboot -d 10 -r “Patch Updates”

Description: Use this command to reboot or shutdown ESXi. The -d parameter is a countdown timer; minimum 10 seconds. ESXi must be in maintenance mode before you can use the command.

Network related commands

#8: esxcli network firewall get

Description: Returns the status of the ESXi firewall. The default action is to drop traffic unless allowed through by a specific firewall rule. The Enabled field indicates whether the firewall is enabled. The Loaded field shows whether the firewall module is active or not (see esxcli firewall load | unload commands).

#9: esxcli network firewall set –enabled true | false

Description: Use this esxcli command to disable the ESXi firewall for troubleshooting purposes. Note that disabling the firewall on ESXi is highly discouraged.

#10: esxcli network firewall ruleset list | grep true

Description: Generates a command list of all enabled firewall rules on ESXi. The command is piped to grep which will matches the value “true” so only enabled rules are displayed.

#11: esxcli network ip interface ipv4 get

Description: Displays the IPv4 configuration for all the interfaces present on ESXi.

Software related commands

#12: esxcli software vib list

Description: Lists all the currently installed VIBs on ESXi. A VIB is a file packaging format used to distribute software on ESXi.

#13: esxcli software vib update -d “/tmp/update.zip”

Description: Use this esxcli command to update an installed VIB on ESXi. Note that the command does not install any new software. Instead it only updates what’s currently installed. Use esxcli software vib install instead when installing new software. The -d parameter specifies the full path to the package being used for the update. As per the next screenshot, I specified a non-existing patch hence the error message.

Virtual Machine related commands

#14: esxcli vm process list

Description: Lists all the running VMs on the hosts. The World ID can be used with other esxcli commands to carry out various tasks related to VMs.

#15: esxcli vm process kill -w 69237 -t soft

Description: Use this command to kill a running VM such as one that fails to respond to commands. You must first retrieve the VM’s World ID (see command #14) and pass it on using the -w parameter. The -t soft | hard | force mandatory parameter sets the type of kill operation. Start with soft so you allow the VM to shut down cleanly. If this does not work, try the hard option which will kill the VM processes immediately as in kill -9. The Force type should only be used as a last resort. If none work, your only option is to reboot ESXi.

Storage related commands

#16: esxcli storage vmfs extent list

Description: The command generates a list of extents for each volume as well as the corresponding device name to UUID mapping.

#17: esxcli storage filesystem list

Description: The command lists of all the volumes or datastores accessible by the ESXi host. The output includes the file system type, disk info along with the volume name, path and UUID.

iSCSI related commands

#18: esxcli iscsi software set –enabled true && esxcli iscsi software get

Description: The above command actually consists of two concatenated commands, which is what && does. The first command enables the iSCSI software adapter and the second verifies that the iSCSI adapter is enabled.

#19: esxcli iscsi adapter param get -A vmhba65

Description: The command returns metrics for the specified iSCSI adapter. These include the current, minimum and maximum values and whether the listed parameters may be configured or not. The name of the iSCSI adapter you want to be queried is specified via the -A parameter. The adapter name is retrieved using esxcli iscsi adapter list or from the vSphere Web client.

Available ESXCLI commands

#20: esxcli esxcli command list

Description: Lists all the available namespaces and corresponding commands.

Restore information from VMFS-formatted drives

Did you lose some vital information that was saved on a VMFS drive? It can be devastating to lose certain private or critical files/documents. However, there’s always a way to get those files back. For the lost files that were saved on your VMFS drive, you can easily get them back using DiskInternals VMFS Recovery.

DiskInternals VMFS Recovery is a professional solution capable of retrieving lost data from VMFS-formatted drives. DiskInternals VMFS Recovery has a plethora of features, which makes it the best VMFS recovery software available. With DiskInternals VMFS Recovery, simply follow the intuitive Recovery Wizard’s instructions to get back your important files, documents, and data.

It is free to download and trusted by so many IT companies, as well as individuals.

Related articles

FREE DOWNLOADVer 4.20, WinBUY NOWFrom $699

Please rate this article.
52 reviews