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 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:
Deploy the vMA appliance on an ESXi system and authenticate against a set of target servers. You can then run ESXCLI commands against any target server by specifying the --host dispatcher option. No additional authentication is required. See the vSphere Management Assistant Guide.
Install the vCLI package on one of the supported Windows or Linux systems. The ESXCLI command set is included. You can run commands against an ESXi or vCenter Server system if you specify connection options. See Installing vCLI.
Command Syntax
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.
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.
If you run commands against ESXi 5.0 hosts, ESXCLI 5.0 commands are supported. ESXCLI 5.1 commands that were included in ESXCLI 5.0 are also supported.
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 or vCLI 5.1.
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.