Using ESXCLI
You can manage many aspects of an ESXi host with 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 Administration Guide and the vSphere PowerCLI Reference.
The set of ESXCLI commands available on a host depends on the host configuration. The vSphere Command-Line Interface Reference lists help information for all ESXCLI commands. Run esxcli --server <MyESXi> --help before you run a command on a host to verify that the command is defined on the host you are targeting.
ESXCLI Syntax
Each ESXCLI 5.0 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 Common Options for vCLI Execution. Not required when you run the command in the ESXi Shell.
namespace. Groups ESXCLI commands. vSphere 5.0 supports nested namespaces.
command. Reports on or modifies state on the system.
Running ESXCLI vCLI Commands
You can run an ESXCLI vCLI command remotely against a specific host or against a vCenter Server system. You have the following choices:
After installation, run ESXCLI commands against a specific host by first specifying all dispatcher options. If the target server is a vCenter Server system, specify the target ESXi host before any ESXCLI namespaces, commands, and supported options.
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
Each time you run a command, you must specify authentication information. See Using the vSphere Command-Line Interface.
Running ESXCLI vCLI Commands Against ESXi 4.x Hosts
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.
VMware partners might develop custom ESXCLI commands that you can run on hosts where the partner VIB has been 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.
Important ESXCLI on ESX 4.x hosts does not support targeting a vCenter Server system. You can therefore not run commands with --server pointing to a vCenter Server system even if you install vCLI 5.0.
Running ESXCLI Commands in the ESXi Shell
ESXCLI commands in the ESXi Shell are fully supported unless they are marked as internal in the online help.
The ESXi Shell is disabled by default. You must enable the ESXi Shell before you can run commands in the shell. See ESXi Shell Access with the Direct Console.
To run an ESXCLI command in the shell
1
2
esxcli storage nfs list
You can use --help at any level of esxcli for help on available namespaces, commands, or options.