Finding the correct esxcli command

The ESXi command esxcli has many namespaces and options to choose from. It may sometimes be hard to find what the exact command is to perform a task. You can of course use a search engine to find what you need. But with this practical tip you can also find what you need with the esxcli command itself.

First let's have a look at the command itself. When you execute the command without any parameters it will show the possible options and namespaces.

If you then execute the command with one of these namespaces it will show the available options for that namespace. It is pretty obvious that when you need information about storage that you would check the storage namespace. But within that namespace there are many options too choose from. It might therefore not always be simple to find the section with the command you need.

The command has an option to show information about itself including a list of all possible commands:

esxcli esxcli command list

This will generate the complete list but that might not be very practical. The next image shows a partial list of commands.

The list with commands can be filtered with grep. In the following examples you can see the output of the command being sent to grep with the pipeline. Use grep -i to ignore case because some commands or options are displayed in uppercase and others in lowercase.


 

Let's look at one of the commands from the example above.

esxcli esxcli command list | grep -i cdp

Configuring Cisco Discovery Protocol for a standard switch can only be done from the command line. The output shows the command as network.vswitch.standard with the set command.

The command to execute would then be:

esxcli network vswitch standard set 

You do need additional commands but the esxcli command will show what's needed. 

 

The full command to set the CDP status to both advertise and listen for vSwitch0 would then be:

esxcli network vswitch standard set -v vSwitch0 -c=both

 

 

 

Follow us on LinkedIn

  

   

   

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer