DCLI – An alternate command line option for vSphere

DCLI is the client of vSphere automation SDK. DCLI works exclusively with the vSphere Automation API (REST API for vSphere) to monitor and manage all features made available to the REST based API.
 
A DCLI command talks to a vSphere Automation SDK endpoint to locate relevant information and then runs the command and displays results to the user.DCLI can interact with the vCenter Server Appliance (VCSA), perform VM tasks, receive environmental vSphere information, managing vSphere Tags, and work with the Content Library.

DCLI Availability:

  • DCLI is included within the vCenter Server Appliance (VCSA) as well as being included as part of the installation process for vCenter Server on Windows. Hence can be launched in local shell on vCenter server directly.
  • DCLI is also available as part of vCLI and can be installed on Windows, Linux, or MacOS systems as it is being available on the Python Package Index (PyPI).

DCLI Modes:

There are two ways to use DCLI, either in an interactive mode or via scripting mode.

Interactive Mode:

As the name suggests, Interactive mode literally means you type and run commands manually for any required activity/actions.
DCLI’s interactive shell has features, such as tab complete and session history retention and the ability to find a namespace just by starting it off with the first few characters.Below is the screenshot of logging in to DCLI from vCLI system with SSL.

Below is another example of logging in to DCLI skipping SSL.

Scripting Mode:
 
The scripting mode allows DCLI commands to be used within scripts. These scripts can then be turned into more extensive workflows and/or scheduled tasks. Calling DCLI commands through the scripting mode is fairly similar to interactive mode, but a server has to be specified each time. The full
namespace has to be referenced as well.

 

Example:

After logging into DCLI, On first use DCLI prompts you to choose for storing credentials in credstore.
 
 
DCLI command to lists available datastore.

Also DCLI helps you build commands as you type. As shown in above example, as you type command, it will show next available namespaces. You can type or press TAB for auto complete.

Output Formatting:

DCLI also has the ability to change how the output from commands are handled. The formatter allows users to specify outputs of CSV, HTML, JSON, Simple, Table, or XML.

 

Leave a Reply