6.5

Table Of Contents
Option and Environment Variable Description
--username <u_name>
VI_USERNAME=<u_name>
Uses the specied user name.
n
If --server species a vCenter Server system, the user name and
password apply to that server. If you can log in to the vCenter Server
system, you need no additional authentication to run commands on the
ESXi hosts that server manages.
n
If --server species an ESXi system, the user name and password apply
to that system.
If you do not specify a user name and password on the command line, the
system prompts you and does not echo your input to the screen.
--vihost <host>
-h <host>
When you run a vCLI command with the --server option pointing to a
vCenter Server system, use --vihost to specify the ESXi host to run the
command against.
N This option is not supported for each command. If supported, the
option is included when you run <cmd> --help.
vCLI Common Options
The following lists options not used as connection options that you can use when you run a vicfg- vCLI
command.
Option Description
--help
Prints a brief usage message. The message rst lists each command-specic option and then each of the
common options.
--verbose
Displays additional debugging information.
--version
Displays version information.
Using vCLI Commands in Scripts
Most administrators run scripts to perform the same task repeatedly or to perform a task on multiple hosts.
You can run vCLI commands from one administration server against multiple target servers.
For example, when a new data store becomes available in your environment, you must make that data store
available to each ESXi host. The following sample script illustrates how to make a NAS data store available
to three hosts (esxi_server_a, esx_server_b, and esxi_server_c).
The sample assumes that a conguration le /home/admin/.visdkrc.<hostname> exists for each host. For
example, the conguration le for esxi_server_a has the following contents.
VI_SERVER = esxi_server_a
VI_USERNAME = root
VI_PASSWORD = xysfdjkat
The script adds the NAS data store to each host dened in VIHOSTS.
#!/bin/bash
VI_CONFIG_FILE=/home/admin/viconfig
VIHOSTS=(esxi_server_a esx_server_b esxi_server_c)
for VIHOST in ${VIHOSTS[@]}
do
echo "Adding NAS datastore for ${VIHOST} ..."
Getting Started with vSphere Command-Line Interfaces
42 VMware, Inc.