[Beginner’s Guide] vSphere Command Line Interface (vCLI)

vSphere Command-line Interface (vSphere CLI) is an official command-line tool to manage your vSphere infrastructure. Next, this article will briefly introduce it and show you how to install it on your system.

Crystal

By Crystal / Updated on March 8, 2023

Share this: instagram reddit

What is vSphere Command-line Interface (CLI)

Virtualization offers great convenient and cost reduction for enterprises in the 21st century. With tools like VMware vSphere, it is possible for administrators to efficiently deploy and manage a large virtual environment on the official VMware vSphere Client. Most of its settings are available in the graphical user interface (GUI), but for all configurations including those not displayed in GUI, you need to use vSphere Command-line Interface (CLI).

vSphere Command-line Interface

vSphere Command-line Interface (vCLI) is a composite package of tools and libraries, including commands for managing different aspects of your environment, either locally or remotely.

For vSphere Command-line Interface download, you can go to VMware’s official website: vSphere CLI or find the installer in the Automation Tools and SDKs section of the Drivers & Tools tab of the vSphere download page.

Components of vSphere CLI command set

Take vSphere 6.7 as an example, the components of the vSphere CLI command set including:

  • ESXCLI commands: Manage many aspects of an ESXi host. You can run ESXCLI commands remotely or in the ESXi Shell.
  • vicfg- and other vCLI commands: Users can manage hosts remotely. You can run the commands against ESXi systems or against a vCenter Server system.
  • esxcfg- commands: Available in the ESXi Shell. esxcfg- commands are included in this release but are deprecated. Migrate to ESXCLI where possible.
  • DCLI commands: DCLI is a CLI client to the vSphere Automation SDK interface for managing VMware SDDC services. You can run virtual machine management, appliance management, content library, and tagging commands with the DCLI command set.
  • VMware PowerCLI cmdlets: VMware PowerCLI provides a Windows PowerShell interface to the vSphere API, includes PowerShell cmdlets for administering vSphere components.
  • localcli commands: Set of commands for use with VMware Technical Support.
  • pktcap-uw utility: Enables you to monitor the traffic that flows through the physical network adapters, the VMkernel adapters, and the virtual machine adapters, and to analyze the packet information by using conventional network analysis tools such as Wireshark.
  • dir-cli vecs-cli certool: Commands for managing the vCenter Single Sign-On and certificate infrastructure.
  • appliancesh: Enables you to configure and troubleshoot the vCenter Server Appliance and to monitor the processes and services running in the appliance.

vSphere CLIs for host and vCenter services management

Updated: Announcing End of Life of vSphere CLI package in vSphere 7.0

VMware has announced the end of life of vSphere CLI.

According to VMware, starting with vSphere 7.0, vSphere CLI package is not be released and it will be end of life, but all existing capabilities of vSphere CLI are supported with more API centric tools such as esxcli and Perl SDK.

You can download esxcli and/or Perl SDK as separate packages. Vicfg scripts shipped with the vCLI package will no longer be available in the future vSphere releases.

How to install vSphere Command-line Interface

Next, this part will show you how to install vSphere Command-line Interface on your system. After installation, you can run vCLI commands and vSphere SDK for Perl utility applications from the operating system command line.

The vCLI installer installs both vSphere SDK for Perl and vCLI because many vCLI commands run on top of the vSphere SDK for Perl. You can install a vCLI package on a Linux or a Microsoft Windows system, and the content of the installer package differs for different platforms.

  • Windows system: You must install required software. The installation package includes vCLI and vSphere SDK for Perl.
  • Linux system: You must install required software and you must have Internet access. The installer downloads other Perl modules from CPAN.

You can select from them according to your system type.

Install the vSphere CLI on Windows system

1. Download the vCLI Windows installer package, and then start the installer, click Next in the Welcome page.

Note: If you are prompted to remove older versions of vSphere SDK for Perl or vCLI, you can either accept or cancel the installation, and install the vCLI package on a different system.
Please note that the installer replaces both the vSphere SDK for Perl and vCLI. If you want to keep an older version, please install this package on a different system.

vSphere CLI Windows Installer Welcome page

2. To install the vCLI in a nondefault directory, click Change and select an alternative directory. And then click Next to continue.

The default location is C:\Program Files\VMware\VMware vSphere CLI.

Destination folder to install vSphere CLI

3. Click Install to proceed with the installation.

Install vSphere CLI

4. The installation might take several minutes to complete. Then you can reboot your system.

Note: If you do not reboot, path settings might not be correct on your Windows platform.

vSphere CLI Windows installation completed

Install the vSphere CLI on Linux system

1. Download the vCLI Linux installer package.

2. Log in as root, and untar the vCLI binary that you downloaded.

tar –zxvf VMware-vSphere-CLI-6.X.X-XXXXX.x86_64.tar.gz

A vmware-vsphere-vcli-distrib directory is created.

3. (Optional) If your server uses a proxy to access the Internet, and if your http:// and ftp:// proxy were not set when you installed prerequisite software, set them now.

export http_proxy=:port

export ftp_proxy=:port

4. Run the installer.

sudo vmware-vsphere-cli-distrib/vmware-install.pl

5. To accept the license terms, enter yes and press Enter.

The installer connects to CPAN and installs prerequisite software. Establishing a connection might take a long time.

6. Specify an installation directory, or press Enter to accept the default, which is /usr/bin.

A complete installation process has the following result.

  • A success message appears.
  • The installer lists different version numbers for required modules, if any.
  • The prompt returns to the shell prompt.

If you accepted the defaults during installation, you can find the installed software in the following locations.

  • vCLI scripts – /usr/bin
  • vSphere SDK for Perl utility applications – /usr/lib/vmware-vcli/apps
  • vSphere SDK for Perl sample scripts – /usr/share/doc/vmware-vcli/samples

A dedicated vSphere backup software – AOMEI Cyber Backup

You may need an effective backup software for VMware vSphere to protect your virtual environment and gain the ability to quickly recover your virtual machines when needed. In this article, I will introduce an efficient vSphere backup software - AOMEI Cyber Backup, which enables you to backup multiple VMs either managed by vCenter Server, or on a standalone ESXi host.

It simplifies the backup process and present the steps with intuitive GUI interface. In addition, it offers you the following benefits.

Agentless Backup: create complete and independent image-level backup for VMware ESXi and Hyper-V VMs.
Flexible vSphere Backup: batch backup large numbers of VMs managed by vCenter Server, or multiple VMs on a standalone ESXi host.
Multiple Storage Destinations: backup to local drive, or network destinations like Windows share or NAS.
Automated Execution: create backup schedules to automate backups daily, weekly, monthly.
Role Assignment: allows one administrator to create sub-accounts with limited privileges.

AOMEI Cyber Backup

AOMEI Cyber Backup supports both paid and free versions of VMware ESXi 6.0 and later versions. Next, I will show you how to perform vSphere VM backup and restore via AOMEI Cyber Backup. You can click the following button to download the free trial.

Download Free TrialVMware ESXi & Hyper-V
Secure Download

*You can choose to install this VM backup software on either Windows or Linux system.

Steps to perform vSphere backup and restore via AOMEI Cyber Backup

Backup multiple VMs:

1. Bind Devices: Access to AOMEI Cyber Backup web client, navigate to Source Device > VMware > + Add VMware Device to Add vCenter or Standalone ESXi host. And then click > Bind Device.

Add VMware ESXi host

2. Create Backup Task: Navigate to Backup Task > + Create New Task, and select VMware ESXi Backup as the Backup Type.

VMware ESXi backup

3. Set the Task Name, Device, Target, Schedule and Cleanup as needed.

  • Task Name: you can change the task name or use the default name with an ordinal.
  • Device: batch backup multiple VMs on vCenter or standalone host within one backup task.

Select virtual machines vCenter

  • Target: select to back up to a local path, or to a network path like NAS.
  • Schedule (optional): perform full, differential, or incremental backup, and automate execution according to the frequency you specified.

Backup schedule type

  • Cleanup (optional): automatically delete the old backup copies that exceed the retention period you specified.

backup cleanup

4. Run Backup: Now you can click Start Backup and select Add the schedule and start backup now, or Add the schedule only.

Start Backup

Created backup tasks will be listed and monitored separately for restoring, progress checking and schedule changing.

Restore VM from backup:

5. Restore from Backup: Select the backup task you want to restore, and click ... > Restore to open the wizard.

Or you can click Backup Management > History Versions. Specify a VM and select a restore point from the left list.

Restire from backup task

6. Start Restore: Choose to Restore to original location or Restore to new location. And click Start Restore to recover the virtual machine in place.

Restore to new location: Create a new VM in the same or another datastore/host directly from the backup to perform out-of-spacre recovery, saves the trouble of re-configuring the new VM.

Restore to new location

Summary

vSphere Command-line Interface (vSphere CLI) is an official administrative interface for managing ESXi hosts, making it possible for you to configure all settings, including the hidden ones from GUI. This article briefly introduced what is vSphere Command-line Interface, and showed you how to install it on Windows or Linux systems.

Except for managing ESXi hosts, protect the data on your virtual machines is also of great importance. You can backup VMware ESXi VMs via AOMEI Cyber Backup, an efficient VM backup software that provides continuous protection for your vSphere environment.

Crystal
Crystal · Editor
Crystal is an editor from AOMEI Technology. She mainly writes articles about virtual machine. She is a positive young lady likes to share articles with peolpe. Off work she loves travelling and cooking which is wonderful for life.