VMware vSphere CLI (vCLI)

VMware vSphere CLI (vCLI) Cheatsheet #

VMware vSphere CLI (vCLI) provides a set of commands for managing vSphere environments from the command line. These commands allow administrators to automate common tasks, manage virtual machines, networks, storage, and perform system management directly from the command line.

vCLI Basics #

Command/OptionExampleDescription
vicfg-cfgbackupvicfg-cfgbackup --server <hostname> -s backup.tgzSave ESXi host configuration to a file
vicfg-cfgbackupvicfg-cfgbackup --server <hostname> -l backup.tgzLoad ESXi host configuration from a file
vicfg-hostopsvicfg-hostops --server <hostname> --operation shutdownShutdown or reboot an ESXi host
vicfg-hostops`vicfg-hostops –server –operation enterexit –maintenance`

Virtual Machine Management #

Command/OptionExampleDescription
vicfg-vmknicvicfg-vmknic --server <hostname> --listList VMkernel network interfaces
vicfg-vswitchvicfg-vswitch --server <hostname> --listList virtual switches
vicfg-nicsvicfg-nics --server <hostname> --listList physical network interfaces
vmware-cmdvmware-cmd -H <hostname> -U <username> -P <password> <vm.vmx> startStart a virtual machine
vmware-cmdvmware-cmd -H <hostname> -U <username> -P <password> <vm.vmx> stopStop a virtual machine

Network Management #

Command/OptionExampleDescription
esxcli network nic listesxcli network nic listList all network interfaces
esxcli network vswitch standard listesxcli network vswitch standard listList all standard virtual switches
esxcli network ip interface listesxcli network ip interface listList all VMkernel network interfaces
esxcli network ip interface addesxcli network ip interface add -i vmk1 -p "Management Network"Add a VMkernel network interface

Storage Management #

Command/OptionExampleDescription
esxcli storage filesystem listesxcli storage filesystem listList all mounted file systems
esxcli storage vmfs extent listesxcli storage vmfs extent listList all VMFS extents
esxcli storage core adapter listesxcli storage core adapter listList all storage adapters
esxcli storage core device listesxcli storage core device listList all storage devices

System Management #

Command/OptionExampleDescription
esxcli system version getesxcli system version getDisplay the version of the ESXi host
esxcli system shutdown rebootesxcli system shutdown reboot --reason "Maintenance"Reboot the ESXi host
esxcli system shutdown poweroffesxcli system shutdown poweroff --reason "Maintenance"Power off the ESXi host
esxcli hardware cpu listesxcli hardware cpu listList CPU information

Host Configuration #

Command/OptionExampleDescription
esxcli hardware memory getesxcli hardware memory getDisplay memory information
esxcli system time getesxcli system time getDisplay the current system time
esxcli system settings advanced listesxcli system settings advanced listList advanced system settings
esxcli system settings advanced setesxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 1Set an advanced system setting

This cheatsheet covers the most commonly used vSphere CLI (vCLI) commands and options, helping you to manage ESXi hosts, virtual machines, networks, storage, and system configurations effectively.

VMware vSphere CLI (vCLI)

Explore our comprehensive cheatsheets to enhance your knowledge and efficiency. Each cheatsheet provides detailed command options, examples, and descriptions to help you master various tools and technologies.