Monday, 26 November 2018

Toggling the vCenter Server Appliance default shell

VMware vCSA is bundled with below supported shells:
  • BASH Shell
  • Appliance Shell
When you connect to vCenter Server initially, by default, you will be in Appliance shell. However, we can toggle between the shells as needed.

Switching the vCenter Server Appliance 6.x to BASH Shell as default
    • Log in to the vCenter Server Appliance through SSH.

    • Run this command to enable access the Bash shell:
      • shell.set --enabled true  and press enter
    • Type shell and press Enter.
    • In the temporary BASH shell, run this command to permanently configure the default Shell to BASH for Root:
      • chsh -s /bin/bash root

    • Log out from the BASH Shell.
    • Log in again for the changes to take effect.

Switching the vCenter Server Appliance 6.x to Appliance Shell as default
    • Log in to the vCenter Server Appliance through SSH. You will be in BASH shell already since it was changed previously.
    • Run below command to change from using the BASH Shell to the Appliance Shell:
      • chsh -s /bin/appliancesh root
    • Log out from the Appliance Shell.
    • Log in again for the changes to take effect.

Sunday, 25 November 2018

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.


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.

Popular Posts This Week