ESXi 5.0 comes with a new ESXCLI command making it easy to administer your ESXi hosts from the command line. Although the ESXCLI command in 5.0 has a similar look and feel as it’s 4.x predecessor, the new command comes with an improved syntax and support for many additional namespaces. In addition, and even more significant, is that for the first time the new ESXCLI provides a single command set that can be used for both local and remote command line administration.
In 5.0 the ESXCLI command is a replacement for the deprecated esxcfg-* commands used in earlier release. It’s important to note that even though the esxcfg-* commands are still included with ESXi 5.0 these commands are deprecated, meaning they are no longer officially supported. They have been left behind to help as you transition over to ESXCLI. The esxcfg-* commands will eventually be removed in future releases.
In vSphere 5.0 the ESXCLI command set is not yet a comprehensive CLI tool. It will take time to add all the required functionality into the ESXCLI command set. Until that happens users will continue to augmented the new ESXCLI with the well known vicfg-*, vmware-cmd, vmkfstools, and other CLI commands. Over time the ESXCLI command set will continually be expanded and the non-ESXCLI commands eventually phased out and deprecated.
Why a new CLI?
A challenge longed faced by vSphere administrators has been the need to use an array of different commands to administer their hosts. In addition, a completely different set of commands was needed when working locally on a host versus remotely through the vCLI. The new ESXCLI command targets these challenges by establishing a single CLI command set that can be used for both local and remote host administration. In addition to providing a single tool, the new ESXCLI command also establishes a standard that will continue to be extended and enhanced. This standard is documented making it easy for vendors to integrate and provide customized plug-ins enabling users to also use the ESXCLI command to manage 3rd party add-on components.
ESXCLI Command Overview
Learning to use the ESXCLI command is very easy. The best way to start is by logging on to the ESXi shell and from the command prompt type “esxcli”:
Typing the command with no options comes back with the usage screen shown above. This method of getting command help will be familiar to people who have used ESXCLI in the 4.x release. From this output we see the section labeled “Available Namespaces:”. Each namespace represents a category of commands, for example there is a namespace for “network” and for “storage”.
Lets look at the “network” namespace to see what additional namespaces and commands are available by running the command “esxcli network”:
Here we see additional namespaces for fence, firewall, IP, vSwitch, and NIC. To see the options are under vswitch you simply type “esxcli network vswitch” (catch the pattern?).
Here we see two namespaces under vSwitch, one for working with a distributed vSwitch and another for a standard vSwitch. Lets see what the command is to display the list of configured standard vSwitches by running “esxcli network vswitch standard”:
Here we again see the additional namespaces, but in addition for the first time we see available commands. From here we can see that in order to list the configured standard vSwitches on the host we run the command “esxcli network vswitch standard list”:
I think you will agree that it wouldn’t require much additional effort to further explore the ESXCLI command to identify how to add a third vSwitch or modify any of the vSwitch settings. And remember, part of what makes ESXCLI really cool is that can be used remotely as well as locally.
ESXi 5.0 comes with a new and improved ESXCLI command set. Different from it’s 4.x predecessor the new ESXCLI command supports many additional namespaces and for the first time provides a common CLI tool that can be used for both local and remote administration.
The new ESXCLI command doesn’t yet provide a comprehensive set of capabilities. The focus for the 5.0 release is to provide a replacement for the now deprecated esxcfg-* commands. As such in vSphere 5.0 the ESXCLI will continue to be augmented with the vicfg-, vmware-cmd and other available CLI tools. Over time, the ESXCLI command set will be expanded and the other CLI tools deprecated.
Learning to use the new ESXCLI command is a breeze with an intuitive and easy to learn syntax. Simply type the “esxcli” command and press enter to get started, then simply navigate through the nested namespaces until you reach the command you need.
Next up we’ll go over some examples of using ESXCLI remotely…