As those of you who’ve worked with ESXi know, the vCLI (vSphere Command Line Interface) plays an important role in managing your environment, since it is a close replica of the familiar command-line environment in the Service Console.  However, we didn’t just stop at duplicating COS commands in the vCLI – we’re continually driving towards making the vCLI even more powerful.   In particular, with vSphere 4.1, we’ve added a number of new interesting and useful capabilities to the vCLI.  So, without further ado, here are the Top Five New vCLI Commands in vSphere 4.1.

Number 5: NFS statistics in resxtop
OK, well, resxtop is not a new command, but we’ve extended it to provide NFS statistics.  And this ability was added in vSphere 4.0 Update 2, not just vSphere 4.1, but given that these were both released about a month apart, I still count it as “new.”  From the vSphere 4.0u2 Release Notes:

vSphere 4.0 Update 2 includes an enhancement of the performance monitoring utilities, esxtop and resxtop. The esxtop/resxtop utilities now provide visibility into the performance of NFS datastores in that they display the following statistics for NFS datastores: Reads/s, writes/s, MBreads/s, MBwrtn/s, cmds/s, GAVG/s (guest latency).

Find out more about resxtop in the Resource Management Guide.

Number 4: AD configuration with vicfg-authconfig
The new Active Directory integration in ESXi (and ESX) 4.1 has proven to be popular with many customers.  In addition to configuration in the vSphere Client and with Host Profiles, you can set this up using vicfg-authconfig.  With this command, you can list supported and active authentication mechanisms, list the current domain, and join or part from an Active Directory domain.  Note that a user who runs vicfg-authconfig to configure Active Directory settings must have the permission to join an AD Domain, as well as administrative privileges on the ESX/ESXi host. See the vSphere Command‐Line Interface Reference for a list of options and examples.

Number 3: Host Operations with vicfg-hostops
This is an example of extending the vCLI command set beyond what was available in the COS.  The vicfg-hostops command performs a variety of host-related tasks.  In addition to causing a host to enter or exit maintenance mode, this command lets you power off or reboot a host.  In addition, you can use it to display some basic information about the host.  The command returns the host name, manufacturer, model, processor type, CPU cores, and memory capacity and boot time. It also returns whether vMotion is enabled and whether the host is in maintenance mode.

Number 2: Network information with esxcli network
This is somewhat of a “hidden” option to the esxcli command, since it is not document in the vCLI Installation and Scripting Guide, nor is it in the online vCLI Reference.  There is only mention of it in the vCLI Release Notes, and that too doesn’t give any details.  Fortunately, now that you are reading this, you can learn all about this option.  It provides two capabilities:

  1. list all active connections: esxcli network connection list
  2. list all ARP table entries: esxcli network neighbor list

The important thing about this command is that, unlike with equivalent commands on the COS, you can get this information without logging into the host.  For example, you could run this command on multiple hosts, all from the same CLI session, and compare outputs.  This adds an “extra dimension” that is not there with COS-based commands.

By the way, if you ever forget the command syntax, the inline help of esxcli will let you look up these options (as well as all other options to this powerful command).  Just enter as much of the command as you can remember (e.g.. “esxcli network”) and the output will list all the remaining allowable options from that point.

Number 1: Kill unresponsive VMs with esxcli vms
And finally, one of the most requested capabilities to be added to the vCLI – the ability to kill a hung VM!  When asked about moving to ESXi, a large number of customers said that there were just a handful of things that they do in the Service Console that they’d like to see available in ESXi.  One of them was this kill capability, and so we decided to add a specific vCLI command for it in vSphere 4.1.  This command is actually an option to the ever-capable esxcli command, as follows:

  • list all active VMs on a host: esxcli vms vm list
  • kill a VM: esxcli vms vm kill –world-id <NNNN> –type <method>
    • The world ID is displayed with the previous ‘list’ command
    • The method is one of soft, hard, or force, which are successively more aggressive in actively terminating the VM-related processes.

(This is another one of those “poorly-documented” commands, but again you can use the handy inline help of esxcli to get the options.)

I hope you find this information useful. Feel free to post in the comments any of your favorite vCLI commands, or questions about any capability you feel would be useful to have.