6.5

Table Of Contents
Using a Configuration File
You can use a text le that contains variable names and seings as a conguration le.
Variables corresponding to the options are shown in “Common Options for vCLI Host Management
Command Execution,” on page 40.
C Limit read access to a conguration le that contains user credentials.
Pass in the conguration le when you run vCLI commands, by using the following syntax.
<command> --config <my_saved_config> <option>
For example:
esxcli --config <my_saved_config> network ip interface list
vicfg-mpath --config <my_saved_config> --list
If you have multiple vCenter Server or ESXi systems and you administer each system individually, you can
create multiple conguration les with dierent names. To run a command or a set of commands on a
server, you pass in the --config option with the appropriate lename at the command line.
The following example illustrates the contents of a conguration le.
VI_PSC = XX.XXX.XXX.XX
VI_USERNAME = administrator@vsphere.local
VI_PASSWORD = admin_password
VI_PROTOCOL = https
VI_SERVER = my_vc
If you have set up your system to run this le, you can run scripts against the specied ESXi host afterwards.
Using Command-Line Options
You can pass in command-line options by using option name and option value pairs in most cases.
For ESXCLI commands, you can use long or short options. An equal sign between option name and option
value is optional.
esxcli --server <vc_HOSTNAME_OR_IP> --username <privileged_user> --password <pw> --vihost
<esxi_HOSTNAME_OR_IP> <namespace> [<namespace]...> <command> --<option_name=option_value>
For other vCLI commands, use long or short options. An equal sign is not supported.
<vicfg- command> --server <vc_HOSTNAME_OR_IP> --username <privileged_user> --password <pw> --
vihost <esxi_HOSTNAME_OR_IP> --<option_name option_value>
Some options, such as --help, have no value.
I Enclose passwords and other text with special characters in quotation marks.
When running commands on Windows, use double quotes (" "). When running commands on Linux, use
single quotes (' ') or a backslash (\) as an escape character.
The following examples connect to the server as user snow-white with password dwarf$.
Getting Started with vSphere Command-Line Interfaces
36 VMware, Inc.