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/Option | Example | Description |
---|
vicfg-cfgbackup | vicfg-cfgbackup --server <hostname> -s backup.tgz | Save ESXi host configuration to a file |
vicfg-cfgbackup | vicfg-cfgbackup --server <hostname> -l backup.tgz | Load ESXi host configuration from a file |
vicfg-hostops | vicfg-hostops --server <hostname> --operation shutdown | Shutdown or reboot an ESXi host |
vicfg-hostops | `vicfg-hostops –server –operation enter | exit –maintenance` |
Virtual Machine Management
#
Command/Option | Example | Description |
---|
vicfg-vmknic | vicfg-vmknic --server <hostname> --list | List VMkernel network interfaces |
vicfg-vswitch | vicfg-vswitch --server <hostname> --list | List virtual switches |
vicfg-nics | vicfg-nics --server <hostname> --list | List physical network interfaces |
vmware-cmd | vmware-cmd -H <hostname> -U <username> -P <password> <vm.vmx> start | Start a virtual machine |
vmware-cmd | vmware-cmd -H <hostname> -U <username> -P <password> <vm.vmx> stop | Stop a virtual machine |
Network Management
#
Command/Option | Example | Description |
---|
esxcli network nic list | esxcli network nic list | List all network interfaces |
esxcli network vswitch standard list | esxcli network vswitch standard list | List all standard virtual switches |
esxcli network ip interface list | esxcli network ip interface list | List all VMkernel network interfaces |
esxcli network ip interface add | esxcli network ip interface add -i vmk1 -p "Management Network" | Add a VMkernel network interface |
Storage Management
#
Command/Option | Example | Description |
---|
esxcli storage filesystem list | esxcli storage filesystem list | List all mounted file systems |
esxcli storage vmfs extent list | esxcli storage vmfs extent list | List all VMFS extents |
esxcli storage core adapter list | esxcli storage core adapter list | List all storage adapters |
esxcli storage core device list | esxcli storage core device list | List all storage devices |
System Management
#
Command/Option | Example | Description |
---|
esxcli system version get | esxcli system version get | Display the version of the ESXi host |
esxcli system shutdown reboot | esxcli system shutdown reboot --reason "Maintenance" | Reboot the ESXi host |
esxcli system shutdown poweroff | esxcli system shutdown poweroff --reason "Maintenance" | Power off the ESXi host |
esxcli hardware cpu list | esxcli hardware cpu list | List CPU information |
Host Configuration
#
Command/Option | Example | Description |
---|
esxcli hardware memory get | esxcli hardware memory get | Display memory information |
esxcli system time get | esxcli system time get | Display the current system time |
esxcli system settings advanced list | esxcli system settings advanced list | List advanced system settings |
esxcli system settings advanced set | esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 1 | Set 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.