You can use a text file that contains variable names and settings as a configuration file.

Variables corresponding to the options are shown in Common Options for vCLI Host Management Command Execution.


Limit read access to a configuration file that contains user credentials.

Pass in the configuration file 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 configuration files with different names. To run a command or a set of commands on a server, you pass in the --config option with the appropriate filename at the command line.

The following example illustrates the contents of a configuration file.

VI_USERNAME = administrator@vsphere.local
VI_PASSWORD = admin_password
VI_SERVER = my_vc

If you have set up your system to run this file, you can run scripts against the specified ESXi host afterwards.