Using ESXCLI for Host Management
You can manage many aspects of an ESXi host with commands in the ESXCLI command set. You can run ESXCLI commands as vCLI commands, or run them in the ESXi Shell in troubleshooting situations.
You can also run ESXCLI commands from the PowerCLI shell by using the Get-EsxCli cmdlet. See the vSphere PowerCLI User’s Guide and the vSphere PowerCLI Cmdlet Reference.
The set of ESXCLI commands that are available on a host depends on the host configuration. The vSphere Command-Line Interface Reference lists help information for all ESXCLI commands. You can run esxcli --server <MyESXi> --help before you run a command on a host to make sure that the command is defined on the host you are targeting.
ESXCLI Syntax
Each ESXCLI command uses the same syntax.
esxcli [dispatcher options] <namespace> [<namespace> ...] <cmd> [cmd options]
dispatcher options. Predefined options for connection information such as target host, user name, and so on. See Running vCLI Host Management Commands. Not required when you run the command in the ESXi Shell. If the target server is a vCenter Server system, specify the target ESXi host before any ESXCLI namespaces, commands, and supported options.
Many ESXCLI commands generate output you might want to use in your application. You can run esxcli with the --formatter dispatcher option and send the resulting output as input to a parser.
Use the --cacertsfile option or VI_CACERTFILE variable
Specify the thumbprint with the --thumbprint option or VI_THUMBPRINT variable.
namespace. Groups ESXCLI commands. vSphere 5.0 and later support nested namespaces.
command. Reports on or modifies state on the system.
Examples
esxcli --server myESXi --username user1 --password 'my_password' storage nfs list
esxcli --server myVCServer --username user1 --password 'my_pwd' --vihost myESXi.mycompany.com storage nfs list
options. Many commands support one or more options, displayed in the help or the vCLI Reference. For some commands, multiple option values, separated by spaces, are possible.
Example
esxcli system module parameters set -m <module> -p "a=1 b=1 c=1"
Running ESXCLI vCLI Commands
You can run an ESXCLI vCLI command in the ESXi Shell for troubleshooting and remotely against a specific host or against a vCenter Server system. You have the following choices:
See Running vCLI Host Management Commands.
ESXCLI Command Support when Host and vCLI Version Do Not Match
When you run an ESXCLI vCLI command, you must know the commands supported on the target host specified with --server or as a vMA target. For example:
VMware partners might develop custom ESXCLI commands that you can run on hosts where the partner VIB is installed.
Run esxcli --server <target> --help for a list of namespaces supported on the target. You can drill down into the namespaces for additional help.