Using a Configuration File
Last Updated December 16, 2024

You can use a text file that contains variable names and settings as a configuration file.
Variables corresponding to the options are shown in Connection Options for ESXCLI Host Management Command Execution.
Limit read access to a configuration file that contains user credentials.
Pass in the configuration file when you run ESXCLI commands, by using the following syntax.
<command> --config <my_saved_config> <option>
The following example illustrates how you can use the syntax.
esxcli --config <my_saved_config> network ip interface 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 file name at the command line.
The following example illustrates the contents of a configuration file.
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 file, you can run scripts against the specified
ESXi
host afterwards.