Mastering ESXi CLI: Essential to Advanced Commands in VMware ESXi 7.0 & 8.0

how to troubleshoot esxi host issues using cli command, esxi 7.0 and 8.0, esxicli commands for esxi host troubleshooting 

VMware ESXi is a bare-metal type 1 hypervisor that runs directly on server hardware to host virtual machines. Managing ESXi hosts often requires using the ESXi Shell or SSH to execute commands for configuration, troubleshooting, and monitoring porpoises. SSH and the CLI are the fastest and sometimes the only way to get things done, especially during troubleshooting, automation, or upgrades.

This article covers essential ESXi 7.0 and 8.0 commands, moving from basic administrative tasks to advanced troubleshooting and configuration.

Let’s dive in the some useful ESXi host commands.

Basic ESXi Host Commands
CommandDescriptionExample / NotesCopy
esxcli system version getShow ESXi version, build, and patch informationUseful to verify exact build details
esxcli system hostname getShow the current host name (and domain)Can verify FQDN settings
esxcli system uptime getShow how long the host has been runningHelps determine if host was recently rebooted
esxcli system stats installtime getShow the ESXi installation date/timeConfirms when host was first installed
esxcli system maintenanceMode set --enable yesEnter maintenance modeRequired before patching or shutdown
esxcli system maintenanceMode set --enable noExit maintenance modeUse after maintenance tasks complete
esxcli system shutdown poweroff -d 60 -r "Updating ESXi"Shutdown host after delaye.g., schedule shutdown with reason
esxcli system shutdown reboot -d 60 -r "Rebooting host"Reboot host after delayDelay and reason optional
dcuiOpen the Direct Console User InterfaceUseful for local console access to host console menu
esxtopLaunch ESX TOP (real-time performance monitor)Shows CPU, memory, network, and disk stats
Networking Commands
CommandDescriptionExample / NotesCopy
esxcli network ip connection listList active TCP/UDP connectionsShows network connections and status
esxcli network nic listList physical NICs on the hostShows link status, speed, driver, and MAC
esxcli network ip interface listList VMkernel network interfacesShows VMkernel vNICs and their IP info
esxcli network ip interface ipv4 getGet IPv4 settings for VMkernel interfacesUseful to confirm IP and subnet
esxcli network vm listList VMkernel network details per VMShows which vNIC is connected to which vSwitch/portgroup
esxcli network vswitch standard listList standard vSwitches and portgroupsShows vSwitch names, MTU, and portgroup names
esxcli network nic stats get -n vmnic0Show statistics for vmnic0Replace vmnic0 as needed for other NICs
esxcli network firewall getGet firewall statusShows if firewall is enabled/disabled
esxcli network firewall ruleset listList all firewall rulesetsUse --enabled flag to see active rulesets
esxcli network firewall set --enabled falseDisable the host firewallUseful for troubleshooting (remember to re-enable)
esxcli network firewall set --enabled trueEnable the host firewallRecommended for production security
Storage Commands
CommandDescriptionExample / NotesCopy
esxcli storage filesystem listList mounted file systems and VMFS datastoresShows datastore names, UUIDs, and mount points
esxcli storage vmfs extent listList VMFS extent informationUseful for detailed VMFS volume layout
esxcli storage core path listList all storage pathsShows paths to storage devices (used for multipathing)
esxcli storage nfs listList mounted NFS volumesShows NFS server, share, and mount status
esxcli iscsi adapter listList iSCSI adapters (software and hardware)Shows iSCSI HBA names
esxcli storage core adapter rescan --allRescan all storage adaptersUse to detect new storage devices or LUNs
esxcli storage core device listList all storage devices (NAA IDs)Find the device ID for SMART checks or RDMs
esxcli storage core device smart get -d naa.XXXGet S.M.A.R.T. info for a diskReplace naa.XXX with device from above
vmkfstools -D /vmfs/volumes/datastore/vm.vmdkCheck disk type (thin/thick)Output shows if disk is thin or thick.
VM Management Commands
CommandDescriptionExample / NotesCopy
vim-cmd vmsvc/getallvmsList all registered VMs on the hostShows VMID, name, file path, guest OS
vim-cmd vmsvc/power.on <vmid>Power on the VM with ID vmidReplace <vmid> with the actual VM ID
vim-cmd vmsvc/power.off <vmid>Power off the VM with ID vmidEquivalent to ACPI shutdown/power off
vim-cmd vmsvc/unregister <vmid>Unregister (remove) VM from inventoryDoes not delete VM files
esxcli vm process listList running VMs and World IDsUse World ID to kill stuck VM processes
esxcli vm process kill --type=soft --world-id=<id>Forcefully kill a VM processUse –type=hard or force if soft fails
vim-cmd vmsvc/snapshot.create <vmid> <snapshot_name>Create a snapshot for VMProvide the VM ID and snapshot name
vim-cmd vmsvc/snapshot.removeall <vmid>Remove all snapshots for VMFree space and consolidate snapshots
vSphere vSAN Cluster Commands
CommandDescriptionExample / NotesCopy
esxcli vsan cluster getShow vSAN cluster membershipDisplays cluster UUID and node list
esxcli vsan cluster join -u <cluster-uuid>Join this host to a vSAN clusterReplace <cluster-uuid> with the target cluster’s UUID
esxcli vsan cluster leaveRemove this host from its vSAN clusterUsed for maintenance or decommissioning
esxcli vsan cluster newCreate a new vSAN cluster with this hostGenerates a new cluster UUID
esxcli vsan cluster preferredfaultdomain getShow preferred fault domain (stretched cluster)Displays currently configured preferred site
esxcli vsan cluster preferredfaultdomain set --preferred-fault-domain-name <name>Set the preferred fault domainUsed in stretched vSAN site configurations
 
Cluster & HA Commands
CommandDescriptionExample / NotesCopy
vim-cmd hostsvc/cluster/getGet cluster infoReturns details if the ESXi host is part of a cluster
esxcli system settings advanced list -o /Cluster/HaList HA advanced settingsDisplays High Availability configuration options
vim-cmd hostsvc/ha/agentstatusCheck HA agent statusShows whether the HA agent is running and healthy
vim-cmd hostsvc/ha/cluster/mastersView HA master hostsIdentify which hosts are HA masters in the cluster
Performance & Troubleshooting Commands
CommandDescriptionExample / NotesCopy
esxtopReal-time performance monitorPress h inside esxtop for help (CPU, memory, network, etc.)
vsishInteractive VMkernel shell (low-level debug)Use with caution; advanced troubleshooting only
esxcli system process listList processes on the hostShows running processes and their usage
esxcli hardware cpu listShow CPU configuration and featuresUseful to verify CPU model, cores, and virtualization support
esxcli hardware memory getShow memory size and module detailsDisplays total memory and DIMM slot info
esxcli hardware environment getRetrieve hardware sensor (temperature, fan) statusDisplays temperature, fan speed, and power state
vmkload_mod --listList loaded VMkernel modules (drivers)Verify if a specific driver or module is loaded
esxcli system syslog config getShow syslog configurationDisplays log output path and rotation settings
Advanced Configuration & Debugging Commands
CommandDescriptionExample / NotesCopy
esxcli system settings advanced listList current advanced settingsUse -d to include default values; many hidden tunables
esxcli system settings advanced set -o /Net/FollowHardwareMac -i 1Set advanced option valueChanges setting to follow MAC on failover (example)
esxcli system syslog config getShow current syslog settingsVerify log file location, rotation, remote syslog etc.
esxcli system syslog reloadReload syslog configurationRequired after making changes to syslog config
esxcli software vib listList all installed VIBsView installed drivers, agents, and patch components
esxcli hardware pci listList all PCI hardware devicesHelpful for HBA, GPU, NIC detection and vendor IDs
    
esxcli system settings kernel listList kernel advanced settingsHelpful for kernel tuning or debugging
esxcli system settings advanced set -o <option> -i <value>Set advanced kernel optionUse with caution for low-level tuning
esxcli system maintenanceMode set --enable trueEnable maintenance modeRequired before host patching or reboot
vim-cmd vimsvc/auth/lockdown_mode_getCheck Lockdown Mode statusReturns current lockdown setting (0, 1, or 2)
vim-cmd vimsvc/auth/lockdown_mode_set 0
vim-cmd vimsvc/auth/lockdown_mode_set 1
vim-cmd vimsvc/auth/lockdown_mode_set 2
Set Lockdown Mode0 = Disabled, 1 = Normal, 2 = Strict
esxcli software vib listList installed VIB packagesShows installed drivers and patch components
esxcli software profile getShow current software profileDisplays ESXi build/version and profile name
esxcli hardware memory getDisplay memory infoShows total installed memory and layout
esxcli system coredump network checkCheck network coredump configVerifies if host is set up for remote coredumps
esxcli system coredump network set --interface-name=vmkX --host=<ip>Set network coredump destinationReplace vmkX and <ip> with actual values

Note:

  • Use vSphere Client, Putty or DCUI to enable SSH for running these commands remotely.
  • Use esxcli <namespace> –help to explore subcommands.
  • Some commands can disrupt host operations. So always put esxi in Maintenance Mode and test in staging environments before production.
  • Use /var/log files extensively for troubleshooting.

Explore related articles on vlookuphub 

Leave a Comment

Your email address will not be published. Required fields are marked *

PHP Code Snippets Powered By : XYZScripts.com
Scroll to Top