ESXCLI Syntax

Each ESXCLI command uses the same syntax.
The following is the standard syntax structure of an ESXCLI command.
esxcli [dispatcher options] <namespace> [<namespace> ...] <cmd> [cmd options]
Syntax Element
Description
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
Shell. If the target server is a
system, specify the target
host before any ESXCLI namespaces, commands, and supported options.
Many ESXCLI commands generate output that 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.
Starting with vSphere 6.0, ESXCLI expects a trust relationship between the target host and the system on which you run the command. You can establish this relationship in one of these ways:
  • Use the
    --cacertsfile
    option or
    VI_CACERTFILE
    variable.
  • Store the thumbprint in the session file.
  • Specify the thumbprint with the
    --thumbprint
    option or
    VI_THUMBPRINT
    variable.
You can pass in the thumbprint that is returned in the error if you trust the host that you are targeting. See Trust Relationship Requirement for ESXCLI Commands for an example.
namespace
Groups ESXCLI commands. vSphere 5.0 and later support nested namespaces.
command
Reports on or modifies the state of the system.
The following examples show how you can use this element.
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 of the options displayed in the help or the vCLI reference. For some commands, multiple option values, separated by spaces, are possible.
The following example shows how you can use this element.
esxcli system module parameters set -m <module> -p "a=1 b=1 c=1"