VMware ESXi commands

Command lines for administering a VMware ESXi host from the ESX Shell or over SSH, checked against Broadcom's ESXCLI reference and vSphere documentation for release 9.1, which calls the hypervisor ESX. Most rows are esxcli commands, grouped by task; other shell tools such as vmkfstools, esxtop and pktcap-uw appear only where Broadcom prints them. Every esxcli command reads as namespace, then action, and esxcli --help works at any level. Capitals mark values you replace.

306 commands in 19 sections. Checked row by row against Broadcom Developer Portal on . Edited by Jay.

Namespaces 18

CommandWhat it does
esxcli daemonDaemon control namespaceControls daemons that were built with the Daemon SDK.
esxcli deviceDevice manager namespace
esxcli esxcliESXCLI introspection namespaceReports on the command set itself, for example a list of every command on the host.
esxcli graphicsGraphics namespace
esxcli hardwareHardware namespaceReports CPUs, memory, PCI devices, IPMI sensors and the platform, and configures a few hardware settings.
esxcli iscsiiSCSI namespaceSets up software and hardware iSCSI adapters, discovery addresses, CHAP and sessions.
esxcli licensingLicensing namespaceHolds the operations that manage license credentials on the host.
esxcli memtierMemory tiering namespaceTurns memory tiering on or off and sets its devices and tier ratio.
esxcli networkNetworking namespaceCovers virtual switches, port groups, VMkernel IP settings, DNS, the firewall and physical adapters.
esxcli nsxNSX namespace
esxcli nvmeNVMe namespaceLists NVMe adapters, controllers and namespaces and reads device logs such as SMART data.
esxcli rdmaRDMA namespaceWorks on the RDMA protocol stack, including the device list and the packet sniffer.
esxcli schedScheduler namespaceHolds the VMkernel properties and settings that deal with scheduling.
esxcli softwareSoftware image namespaceLists and changes what is installed: VIBs, components, image profiles, the base image and the acceptance level.
esxcli storageStorage namespaceCovers devices, paths, adapters, multipathing plug-ins and VMFS and NFS datastores.
esxcli systemSystem namespaceCovers host name, time, maintenance mode, modules, advanced settings, syslog, core dumps, accounts and shutdown.
esxcli vmVirtual machine namespaceLists running virtual machines and force-stops one that no longer responds.
esxcli vsanvSAN namespaceReads and changes vSAN cluster membership, vSAN networking and the disks vSAN has claimed.

Help, output format and remote targets 7

Examples in Broadcom's guides contain a connection-options placeholder after esxcli; in the ESX Shell on the host you leave it out, as the rows here do.

CommandWhat it does
esxcli --helpShow help at any levelAdd it after a namespace or a command to see what is available below that point.
esxcli esxcli command listList every commandPrints all commands the targeted host supports, so it also reveals what a partner VIB added.
esxcli --formatter=csv storage filesystem listPrint output as CSVThe formatter option goes before the namespace and also accepts xml and keyvalue.
esxcli --formatter=keyvalue storage filesystem listPrint key-value outputRedirect the result to a file when another program has to parse it.
esxcli --server myESXi --username user1 --password 'my_password' storage nfs listTarget a host remotelyConnection options stand before the namespace; inside the ESX Shell they are not needed.
esxcli --server MyVC --vihost MyESXi storage filesystem listRun a command through vCenterNeeded for a host in lockdown mode; you are asked for the vCenter user name and password.
esxcli --server MyESXi --helpCheck commands on a remote hostLists what that host offers, so you can confirm a command exists there before running it.

System and maintenance mode 23

CommandWhat it does
esxcli system version getShow version and buildPrints product name, version and build number; --alternate reports the image in the other boot bank.
esxcli system hostname getShow host and domain nameReturns the host name, the domain and the fully qualified name.
esxcli system hostname set --host NEW_HOST_NAMESet the host nameReturns an error on a host that takes its network settings from DHCP.
esxcli system uuid getShow system UUID
esxcli system time getShow system time
esxcli system stats uptime getShow uptimeThe value is given in microseconds.
esxcli system stats installtime getShow first install dateThe date stays the same after later updates of the host.
esxcli system boot device getShow boot device
esxcli system ntp getShow NTP configurationAdd --server-names to print only the server host names.
esxcli system maintenanceMode getCheck maintenance mode state
esxcli system maintenanceMode set --enable trueEnter maintenance modeThe host switches only once every virtual machine on it is suspended or migrated.
esxcli system maintenanceMode set --enable falseExit maintenance modeReports an error when the host has already left maintenance mode.
esxcli system shutdown reboot --reason REASONReboot the hostThe reason is mandatory, the host has to be in maintenance mode, and --delay waits a number of seconds.
esxcli system shutdown poweroff --reason REASONPower off the hostA managed host drops its vCenter connection but stays in the inventory.
esxcli system process listList UserWorld processes
esxcli system module list --enabled=trueList enabled VMkernel modules
esxcli system module list --loaded=trueList loaded VMkernel modules
esxcli system module set --module MODULE_NAME --enabled=trueEnable a VMkernel modulePass --enabled=false to disable the module instead.
esxcli system module parameters list --module MODULE_NAMEList module parametersUse it after a change to confirm how the module is configured.
esxcli system module parameters set -m MODULE -p "a=1 b=1 c=1"Set module parametersSeveral values go into one quoted string, separated by spaces.
esxcli system settings advanced list -o /VMFS3/MaxAddressableSpaceTBShow one advanced optionWithout -o every VMkernel advanced option is listed; --delta keeps only changed ones.
esxcli system settings advanced set -o /Mem/MemEagerZero -i 1Set an advanced optionPass a number with -i and a text value with -s.
esxcli system settings kernel list -o execInstalledOnlyShow one kernel settingLeave out -o to list all VMkernel kernel settings.

Users, roles and security 15

CommandWhat it does
esxcli system account listList local user accounts
esxcli system account add --id USER --password PASSWORD --password-confirmation PASSWORDCreate a local userAdd --description for a full name; shell access is allowed by default for new users.
esxcli system account set --id USER --shell-access falseTurn off a user's shell accessLeaves the account usable through the API only.
esxcli system account remove --id USERDelete a local user
esxcli system permission listList permissionsThe second column says whether an entry is a user or a group.
esxcli system permission set --id test1 -r ReadOnlyAssign a roleRoles are Admin, ReadOnly and NoAccess; add --group true when the ID names a group.
esxcli system permission unset --id test1Remove a permission
esxcli system settings encryption getShow secure configuration modePrints the mode, TPM or NONE, and whether secure boot is required.
esxcli system settings encryption set --mode=TPMSwitch to TPM modeFor hosts whose TPM is active in firmware; once set it cannot be undone.
esxcli system settings encryption recovery listList recovery keysKeep the output in a safe remote place; it holds the recovery ID and key.
esxcli system security keypersistence enableTurn on key persistenceCheck first that the host runs in TPM mode.
esxcli system tls server getShow server TLS profileShows the profile for the next boot; --show-current-boot-profile gives the values in use now.
esxcli system tls server set --profile MANUALChange the TLS profileProfiles are COMPATIBLE (the default), NIST_2024 and MANUAL; the change needs a reboot.
esxcli system security certificatestore listList CA certificates
esxcli system security certificatestore add --filename LOCAL_FILEAdd a CA certificateRequired before the host can log to a remote syslog server over TLS.

Network adapters and VMkernel interfaces 22

CommandWhat it does
esxcli network nic listList physical adapters
esxcli network nic get -n vmnicXShow one adapter's settings
esxcli network nic down --nic-name=vmnic0Bring an uplink downThe name has to be one that the nic list command shows.
esxcli network nic up --nic-name=vmnic0Bring an uplink up
esxcli network nic set --nic-name NIC --autoAutonegotiate speed and duplexFixed values go in --speed and --duplex instead.
esxcli network nic stats get -n vmnic0Show adapter statistics
esxcli network nic vlan stats get -n vmnic0Show per-VLAN packet countsCounts packets sent and received for each active VLAN on the NIC.
esxcli network nic tso getCheck TSO stateTells for each physical adapter whether TCP segmentation offload is on.
esxcli network ip interface listList VMkernel interfacesShows port group, MTU and current state of every VMkernel adapter.
esxcli network ip interface ipv4 getShow IPv4 settingsIncludes the DHCP settings of each VMkernel NIC; -n limits the output to one of them.
esxcli network ip interface ipv4 address listShow IPv4 addresses and gatewaysThe Gateway column gives the gateway of each VMkernel port.
esxcli network ip interface ipv6 address listList IPv6 addressesLimit the output to one interface with --interface-name.
esxcli network ip interface add --interface-name VMK --portgroup-name MY_PORTGROUPAdd a VMkernel interfaceThe new interface still needs an IPv4 or IPv6 configuration.
esxcli network ip interface ipv4 set --interface-name VMK --ipv4 IP_ADDRESS --netmask=255.255.255.0 --type=staticSet a static IPv4 addressA static setup needs the address, the netmask and the interface name.
esxcli network ip interface ipv4 set --interface-name VMK --type=dhcpUse DHCP on an interface
esxcli network ip interface set --interface-name INTERFACE --mtu MTUSet the interface MTUThe same command turns an interface on or off with --enabled.
esxcli network ip interface remove --interface-name INTERFACERemove a VMkernel interfaceThe interface can also be picked by its port group with --portgroup-name.
esxcli network ip interface tag get --interface-name INTERFACEShow interface service tagsTags such as Management, VMotion or VSAN mark the traffic an adapter carries.
esxcli network ip connection listList active connectionsThe counterpart of netstat on Linux.
esxcli network ip neighbor listShow the ARP tableAdd --interface-name to see the neighbors of a single VMkernel interface.
esxcli network ip netstack listList TCP/IP stacks
esxcli network ip set --ipv6-enabled=falseTurn off IPv6The change takes effect only after the host is rebooted.

Virtual switches and port groups 17

CommandWhat it does
esxcli network vswitch standard listList standard switchesOutput covers port count, MTU, uplinks, port groups and CDP settings.
esxcli network vswitch standard add --vswitch-name=vSwitch42Create a standard switchAdd --ports to choose the number of ports instead of the default.
esxcli network vswitch standard remove --vswitch-name=vSwitch42Delete a standard switchNot possible while VMkernel networks or virtual machines still use ports on it.
esxcli network vswitch standard set --mtu=9000 --vswitch-name=vSwitch1Set the switch MTUThe new size applies to every uplink assigned to the switch.
esxcli network vswitch standard set --cdp-status=listen --vswitch-name=vSwitch1Set the CDP modeAccepted values are down, listen, advertise and both.
esxcli network vswitch standard uplink add --uplink-name=vmnic15 --vswitch-name=vSwitch0Attach an uplinkThe adapter joins as standby until the failover policy makes it active.
esxcli network vswitch standard uplink remove --uplink-name=vmnic15 --vswitch-name=vSwitch0Detach an uplink
esxcli network vswitch standard policy failover get --vswitch-name VSWITCHShow failover policy
esxcli network vswitch standard policy security get --vswitch-name VSWITCHShow security policy
esxcli network vswitch standard policy shaping get --vswitch-name VSWITCHShow traffic shaping policy
esxcli network vswitch standard portgroup listList port groupsEach port group appears with its switch, active clients and VLAN ID.
esxcli network vswitch standard portgroup add --portgroup-name NAME --vswitch-name VSWITCHAdd a port groupBoth the port group name and the switch are required.
esxcli network vswitch standard portgroup remove --portgroup-name NAME --vswitch-name VSWITCHDelete a port group
esxcli network vswitch standard portgroup set -p PG_NAME --vlan-id 4095Set VLAN 4095 on a port groupID 4095 lets the port group reach port groups on other VLANs.
esxcli network vswitch standard portgroup set --vlan-id 0 -p g42Remove VLAN taggingVLAN ID 0 switches the VLAN off for that port group.
esxcli network vswitch standard portgroup policy failover set -p testPortgroup --active-uplinks vmnic3,vmnic5 --standby-uplinks vmnic1,vmnic0,vmnic6,vmnic7Set active and standby uplinksA new active list replaces the old one, so name the adapters you want kept as standby.
esxcli network vswitch dvs vmware listList distributed switchesAdd --vds-name to show a single distributed switch.

DNS, hosts file and routes 10

CommandWhat it does
esxcli network ip dns server listList DNS serversServers appear in the order they are used; nothing is returned when DNS is not set up.
esxcli network ip dns server add --server SERVERAdd a DNS serverRun it once per server to configure several.
esxcli network ip dns server remove --server SERVERRemove a DNS server
esxcli network ip dns search listList DNS search domainsAdd -N with a netstack name, for example vmotion, to query another TCP/IP stack.
esxcli network ip dns search add --domain DOMAINAdd a DNS search domain
esxcli network ip hosts listList hosts file entries
esxcli network ip hosts add --hostname www.samplehostname.com --ip xx.xx.xx.xxAdd a hosts file entryEntries made this way survive a reboot of the host.
esxcli network ip hosts remove --hostname www.samplehostname.com --ip xx.xx.xx.xxRemove a hosts file entry
esxcli network ip route ipv4 listList IPv4 routesUse -N to read the table of another network stack.
esxcli network ip route ipv4 add --gateway GATEWAY --network NETWORKAdd a static IPv4 routeWrite the network with its prefix length, or the word default for the default route.

Firewall 12

CommandWhat it does
esxcli network firewall getShow firewall statusReports whether the firewall is enabled and loaded and what the default action is.
esxcli network firewall set --default-action falseDrop traffic by defaultfalse makes the default action drop, true makes it pass.
esxcli network firewall set --enabled trueTurn the firewall on
esxcli network firewall refreshReload firewall rule setsRe-reads the rule set files, provided the firewall module is loaded.
esxcli network firewall ruleset listList firewall rule sets
esxcli network firewall ruleset list --ruleset-id sshServerCheck one rule setShows whether that one rule set is enabled.
esxcli network firewall ruleset set --ruleset-id sshServer --enabled trueEnable a rule set
esxcli network firewall ruleset set --ruleset-id sshServer --allowed-all falseLimit a rule set to listed IPsAfter this only addresses on the allowed list can reach the service.
esxcli network firewall ruleset allowedip add --ruleset-id sshServer --ip-address 192.XXX.1.0/24Allow an address rangeA single address works the same way as a range.
esxcli network firewall ruleset allowedip list --ruleset-id sshServerList allowed addressesA value of All means the rule set accepts every address.
esxcli network firewall ruleset allowedip remove --ruleset-id RULESET --ip-address ADDRESSRemove an allowed addressAccepts a single address or a range, like the add command.
esxcli network firewall ruleset rule listList rules per rule setAdd --ruleset-id to see the rules of one rule set only.

Storage devices and paths 24

CommandWhat it does
esxcli storage core device listList storage devicesShows name, device type, display name and multipathing plug-in of each logical device.
esxcli storage core device list -d mpx.vmhba32:C0:T1:L0Show one storage device
esxcli storage core device capacity listList device capacity and formatThe format type column reads 512n, 512e or 4Kn.
esxcli storage core device uidmap listMap device identifiersShows the primary UID of each device next to its alternative UIDs.
esxcli storage core adapter listList storage adaptersPrints each HBA with its UID.
esxcli storage core adapter rescan --allRescan all adaptersDo this after every change to the storage setup.
esxcli storage core adapter rescan --adapter=vmhba33 --skip-claimRescan one adapterWith --skip-claim the multipath plug-ins leave newly found devices unclaimed.
esxcli storage core path listList storage pathsShows every device with its paths, their state and the adapter type.
esxcli storage core path list --device DEVICEList paths of one device
esxcli storage core path stats getShow path statisticsAdd --path to limit the statistics to one SCSI path.
esxcli storage core path set --state off --path vmhba32:C0:T1:L0Turn off a pathThe change fails while I/O is active on the path; send the command again.
esxcli storage core path set --state active --path vmhba32:C0:T1:L0Reactivate a path
esxcli storage core device world list -d DEVICESee what uses a deviceA world name containing idle0 means a VMFS volume uses the device indirectly.
esxcli storage core device set -d naa.XXX --state=offDetach a storage deviceThe device stays offline across reboots and rescans until someone attaches it again.
esxcli storage core device set -d naa.XXX --state=onReattach a storage device
esxcli storage core device detached listList detached devicesShows the devices that were taken offline by hand.
esxcli storage core device smart get -d DEVICEShow SMART dataParameters the device does not report appear as N/A.
esxcli storage core device stats get -d t10.xxxxxxxxxxxxxxxShow device I/O statisticsIncludes the blocks written since the last reboot, a figure used to estimate flash lifetime.
esxcli storage core device setconfig -d naa.id --perennially-reserved=trueMark a device perennially reservedMeant for RDM devices of a WSFC cluster; the flag persists across restarts.
esxcli storage core device vaai status get -d DEVICECheck VAAI support
esxcli storage san fc listList Fibre Channel adapter attributesThe same list exists for iscsi, fcoe and sas in place of fc.
esxcli storage san fc events getShow Fibre Channel eventsAdd --adapter to read the events of one FC adapter.
esxcli nvme device listList NVMe devices
esxcli nvme device log smart get -A ADAPTERShow the NVMe SMART logUse it to watch remaining lifespan and wear of an NVMe device.

Datastores on VMFS and NFS 19

CommandWhat it does
esxcli storage filesystem listList datastores and volumesCovers mounted and unmounted volumes with mount point, UUID, type, size and free space.
esxcli storage filesystem mount --volume-label LABELMount a volume by label--volume-uuid works in place of the label, and --no-persist keeps the mount from surviving a reboot.
esxcli storage filesystem unmountUnmount a volumeWorks for snapshot and resolved volumes; name the volume with --volume-label or --volume-uuid.
esxcli storage filesystem rescanScan for new file systems
esxcli storage vmfs extent listList VMFS extentsThe Device Name and Partition columns show which device backs each datastore.
esxcli storage vmfs snapshot listList unresolved VMFS copies
esxcli storage vmfs snapshot mountMount a VMFS copy as isKeeps the existing signature; choose the copy with --volume-label or --volume-uuid.
esxcli storage vmfs snapshot resignature --volume-label LABELResignature a VMFS copyGives the copy a new UUID and label; this cannot be reversed, and the copy must be unmounted first.
esxcli storage vmfs unmap --volume-label datastore1 --reclaim-unit 100Reclaim free spaceEach pass unmaps the stated number of blocks; without the option the unit is 200.
esxcli storage vmfs unmap -u 515615fb-1e65c01d-b40f-001d096dbf97Reclaim space by volume UUIDGive either the label or the UUID, never both.
esxcli storage vmfs reclaim config get -l my_datastoreShow automatic unmap settings
esxcli storage vmfs reclaim config set --volume-label datastore_name --reclaim-priority noneTurn off automatic unmapPriorities low, medium and high switch automatic space reclamation back on.
esxcli storage vmfs lockmode listShow VMFS locking mode
esxcli storage nfs listList NFS datastoresShows mount name, share, server and whether each one is mounted.
esxcli storage nfs add --host HOST --share SHARE --volume-name NAMEMount an NFS datastoreHost, share and volume name must all be given; --readonly mounts the share without write access.
esxcli storage nfs remove --volume-name=FileServerHome2Remove an NFS datastoreUnmounts the file system and takes it off the list of known ones.
esxcli storage nfs41 listList NFS 4.1 datastores
esxcli storage nfs41 add -I 10.187.114.32:vmk0 -I 10.187.214.27:vmk1 -s /store1 -v store1Mount NFS 4.1 over chosen adaptersEach -I pairs a server address with the VMkernel adapter that reaches it.
voma -m vmfs -f check -d /vmfs/devices/disks/naa.xxxx:xCheck VMFS metadataGive the absolute path of the partition behind the datastore; power off or migrate its virtual machines first.

Multipathing and claim rules 18

CommandWhat it does
esxcli storage nmp device listList NMP devicesOnly devices that NMP has claimed let you change the path policy.
esxcli storage core plugin registration list --plugin-class="PSP"List path selection policiesThe names it returns are the values that --psp accepts.
esxcli storage nmp device set --device naa.xxx --psp VMW_PSP_RRChange the path policyThis example puts the device on round robin.
esxcli storage nmp psp fixed deviceconfig get --device naa.xxxShow the preferred path
esxcli storage nmp psp fixed deviceconfig set --device naa.xxx --path vmhba3:C0:T5:L3Set the preferred pathApplies to devices on the fixed policy; --default clears the choice.
esxcli storage nmp psp roundrobin deviceconfig get --device DEVICEShow round robin settings
esxcli storage nmp psp roundrobin deviceconfig set --type=iops --iops 4200 --device naa.xxxSwitch paths by I/O countThe device moves on to the next path after 4200 I/O operations.
esxcli storage nmp path list --device DEVICEList NMP paths of a deviceWithout a filter the command covers all paths on all devices.
esxcli storage nmp satp listList SATPs
esxcli storage nmp satp rule listList SATP claim rulesFilter to one plug-in with --satp.
esxcli storage core plugin list --plugin-class=MPList multipathing plug-insOther classes are Filter, VAAI and all.
esxcli storage core claimrule list --claimrule-class=MPList multipathing claim rulesThe class can also be Filter, VAAI or all.
esxcli storage core claimrule add -r 321 -t location -A vmhba0 -C 0 -T 0 -L 0 -P NMPAdd a claim rule by locationRule 321 hands the path on that adapter, channel, target and LUN to NMP.
esxcli storage core claimrule loadLoad claim rulesFollow it with the run command to apply the loaded rules.
esxcli storage core claimrule runApply loaded claim rulesOtherwise the system picks up rule changes on its own every five minutes.
esxcli storage core claimrule remove -r 1015Delete a claim ruleLook up the rule ID with the list command.
esxcli storage core claiming unclaim -t location -A vmhba0 -C 0 -T 0 -L 149Unclaim a pathOnly inactive paths without I/O can be unclaimed.
esxcli storage hpp device listList HPP devices

iSCSI 15

CommandWhat it does
esxcli iscsi software set --enabled=trueEnable software iSCSI
esxcli iscsi software getCheck software iSCSI statePrints true when software iSCSI is on and false when it is off.
esxcli iscsi adapter listList iSCSI adapters
esxcli iscsi adapter set --adapter ADAPTER_NAME --alias ALIASSet the iSCSI aliasThe same command sets the iSCSI name with --name.
esxcli iscsi networkportal add --nic BOUND_VMKNIC --adapter ISCSI_ADAPTERBind a VMkernel NIC to iSCSIRepeat it for every VMkernel port the adapter should use.
esxcli iscsi networkportal list --adapter ADAPTER_NAMEList iSCSI port bindings
esxcli iscsi logicalnetworkportal list --adapter ADAPTER_NAMEList logical network portals
esxcli iscsi physicalnetworkportal list --adapter ADAPTER_NAMEList physical network portals
esxcli iscsi adapter discovery sendtarget add --address ADDRESS --adapter ADAPTERAdd a dynamic discovery addressDynamic discovery finds all targets behind the host name or IP address.
esxcli iscsi adapter discovery statictarget add --address ADDRESS --adapter ADAPTER --name NAMEAdd a static targetStatic discovery also needs the iSCSI name of the target.
esxcli iscsi adapter discovery rediscover --adapter ADAPTERRediscover iSCSI targetsFinish an iSCSI setup with a rediscovery and then a rescan of the adapter.
esxcli storage core adapter rescan --adapter=vmhba36Rescan the iSCSI adapter
esxcli iscsi session list --adapter ISCSI_ADAPTERList iSCSI sessionsAdd --name with a target to list at target level.
esxcli iscsi session add --adapter ADAPTER_NAMELog in to iSCSI sessionsAdd --name to log in to a single target.
esxcli iscsi session remove --adapter=vmhba36Remove iSCSI sessionsRemoves the sessions at adapter level; --name narrows it to one target.

Virtual disks with vmkfstools 13

CommandWhat it does
vmkfstools -P -h /vmfs/volumes/my_vmfsShow datastore attributesLists label, extents, UUID and backing devices; -h prints the capacity in a readable form.
vmkfstools -C vmfs6 -S my_vmfs /vmfs/devices/disks/naa.ID:1Create a VMFS6 datastore-S sets the volume label of the new datastore.
vmkfstools -Z /vmfs/devices/disks/naa.disk_ID_2:1 /vmfs/devices/disks/naa.disk_ID_1:1Add an extent to a datastoreThe span partition comes first and loses all its data; the head partition comes second.
vmkfstools --growfs /vmfs/devices/disks/disk_ID:1 /vmfs/devices/disks/disk_ID:1Grow a datastoreFor use after the underlying storage received more capacity.
vmkfstools -c 2048m /vmfs/volumes/myVMFS/disk.vmdkCreate a virtual diskMakes an empty two-gigabyte disk; -d selects thin, zeroedthick or eagerzeroedthick.
vmkfstools --eagerzero /vmfs/volumes/myVMFS/VMName/disk.vmdkConvert to eager-zeroed thickConverts a zeroedthick disk and keeps the data on it.
vmkfstools -i /vmfs/volumes/myVMFS/templates/gold-master.vmdk /vmfs/volumes/myVMFS/myOS.vmdkClone a virtual diskThe source path comes first, the copy second; only root may clone a disk.
vmkfstools -i /vmfs/volumes/myVMFS/templates/gold-master.vmdk /vmfs/volumes/myVMFS/myOS.vmdk -d thinClone to thin format-d converts the copy to another disk format while cloning.
vmkfstools -X 5g DISKExtend a virtual diskThe size is the new total, not the increment; never extend a base disk that has snapshots.
vmkfstools -r /vmfs/devices/disks/disk_ID my_rdm.vmdkCreate a virtual RDMThe .vmdk becomes a mapping file that points at the raw LUN.
vmkfstools -z /vmfs/devices/disks/naa.600a0000000000000... /vmfs/volumes/datastore1/mydisk.vmdkCreate a pass-through RDMLets the virtual machine bypass ESX SCSI command filtering for that LUN.
vmkfstools -q /vmfs/volumes/VMFS/my_vm/my_rdm.vmdkShow RDM attributesThe attributes identify the storage device behind the mapping file.
vmkfstools -x check /vmfs/volumes/my_datastore/my_disk.vmdkCheck a virtual diskWrite repair in place of check to fix a corrupted disk.

Virtual machines 8

Try the kill types in order: soft before hard, hard before force.

CommandWhat it does
esxcli vm process listList running virtual machinesGives the World ID that the kill command needs; machines that are not running are left out.
esxcli vm process kill --type soft --world-id IDSoft-kill a virtual machineLets the VMX process shut down in an orderly way, like kill -SIGTERM; try this type first.
esxcli vm process kill --type hard --world-id IDHard-kill a virtual machineEnds the VMX process at once, like kill -9; use it when soft did not help.
esxcli vm process kill --type force --world-id IDForce-kill a virtual machineLast resort after soft and hard; guest data may be lost, as when a power cable is pulled.
esxcli network vm listList VM networksGives World ID, name, port count and networks of each running virtual machine.
esxcli network vm port list -w 10408List a VM's switch portsTakes the World ID and returns port ID, vSwitch, port group, MAC and IP address.
esxcli network port stats get -p 12345678Show port packet statisticsCounts packets and bytes sent, received and dropped on that port ID.
esxcli network port filter stats get -p 12345678Show port filter statistics

Software and patches 25

For ZIP bundles supplied by VMware, Broadcom supports only the image profile update; the vib update and vib install commands are for other depots.

CommandWhat it does
esxcli software vib listList installed VIBs
esxcli software vib list --rebooting-imageList VIBs active after rebootReturns nothing when no pending-reboot image exists.
esxcli software vib get -n VIBNAMEShow details of a VIB
esxcli software vib install --depot PATH_TO_VMWARE_VIB_ZIP_FILEInstall VIBs from a depotNot supported for upgrades from VMware-supplied depots; update the image profile there.
esxcli software vib install --dry-runPreview a VIB installationAppended to a normal install command, it reports the VIB operations and any reboot without changing the host.
esxcli software vib update --depot DEPOT_NAMEUpdate installed VIBsOnly brings VIBs already on the host to newer versions; nothing new is installed.
esxcli software vib remove --vibname VIBRemove a VIBAdd --dry-run to see what would be removed first.
esxcli software sources vib list --depot DEPOT_URLList VIBs in a depotWith --viburl the command describes a single VIB instead of a whole depot.
esxcli software sources vib get -v ABSOLUTE_PATH_TO_VIBCheck a VIB before installingThe answer tells whether maintenance mode or a reboot will be required.
esxcli software sources profile list --depot DEPOT_URLList image profiles in a depot
esxcli software profile getShow the installed image profileAlso shows the acceptance level and the history of profile changes.
esxcli software profile update --depot DEPOT_LOCATION --profile PROFILE_NAMEUpdate from an image profileUpdates matching VIBs from the profile and leaves the other installed VIBs alone.
esxcli software profile install --depot DEPOT_LOCATION --profile PROFILE_NAMEInstall an image profileRemoves every installed VIB that is not part of the profile.
esxcli software profile update --dry-runPreview a profile updateAppend it to the full command with --depot and --profile.
esxcli software acceptance getShow host acceptance levelThe level controls which VIBs the host will accept.
esxcli software acceptance set --level LEVELChange host acceptance levelLevels are VMwareCertified, VMwareAccepted, PartnerSupported and CommunitySupported, spelled with that case.
esxcli software component listList installed componentsEach entry has name, version, vendor, creation date and acceptance level.
esxcli software component get -n COMPONENT_NAMEShow one componentAppend :version to the name when several components share it; names are case-sensitive.
esxcli software baseimage getShow the base image
esxcli software addon getShow the vendor add-on
esxcli software sources component list -d DEPOT_URL_OR_OFFLINE_BUNDLE_PATHList components in a depotThe depot is the URL of an online index.xml or the datastore path of an offline bundle.
esxcli software component apply -n COMPONENT_NAME -d DEPOT_URL_OR_OFFLINE_BUNDLE_PATHInstall or update a componentWrite the component as name:version.
esxcli software component remove -n COMPONENT_NAMERemove a component
esxcli software apply -s LOCATION_OF_SOFTWARE_SPEC -d DEPOT_URL_OR_OFFLINE_BUNDLE_PATHApply a complete imageThe JSON software specification names the base image, the add-on and the components.
esxcli software component signature verifyVerify component signaturesWith --rebooting-image it checks an image that was applied but not yet booted.

Hardware 17

CommandWhat it does
esxcli hardware cpu listList CPUs
esxcli hardware cpu global getShow global CPU properties
esxcli hardware memory getShow memory informationThe output includes how much memory counts as reliable.
esxcli hardware pci listList PCI devicesFilter with --class and a hexadecimal class ID.
esxcli hardware pci pcipassthru listList PCI passthrough devices
esxcli hardware platform getShow platform information
esxcli hardware clock getShow hardware clock time
esxcli hardware bootdevice listShow boot device order
esxcli hardware power policy getShow the power policy
esxcli hardware trustedboot getShow trusted boot statusCovers the TPM and DRTM state.
esxcli hardware ipmi sdr listList IPMI sensor data
esxcli hardware ipmi sel listList the IPMI event log
esxcli hardware usb passthrough device listList USB passthrough devices
esxcli hardware usb passthrough device enable -d busId:dev:VendorID:ProductIDEnable USB passthroughCopy the device string from the USB device list; the change affects every virtual machine.
esxcli hardware usb passthrough device disable -d busId:dev:VendorID:ProductIDDisable USB passthrough
esxcli memtier config getShow memory tiering configuration
esxcli memtier enable -d DEVICE_1Turn on memory tieringPut the host in maintenance mode first.

Logs, core dumps and SNMP 27

CommandWhat it does
esxcli system syslog config getShow syslog configurationShows the current global values such as log directory, rotations and remote host.
esxcli system syslog config set --default-rotate=20Keep 20 log rotationsAll logs then keep twenty rotations before the oldest is overwritten.
esxcli system syslog config set --loghost='myhost.mycompany.com'Send logs to a remote hostWith a bare host name the logs travel over UDP port 514.
esxcli system syslog config set --loghost='tcp://myhost.mycompany.com:1514'Send logs over TCPThe tcp:// prefix and the number after the colon choose transport and port.
esxcli system syslog config logger set --id=vmkernel --size=2048 --rotate=10Set rotation for one loggerKeeps ten VMkernel log files and rotates each at 2 MB.
esxcli system syslog mark --message="this is a message!"Write a marker to all logsThe message appears in every log at the same time.
esxcli system syslog reloadReload the syslog daemonRun it after configuration changes so that they take effect.
esxcli system syslog config logfilter listList log filters
esxcli system syslog config logfilter add --filter="10|Hostd|mark"Add a log filterThe three parts are the allowed match count, the application ident and a Python regular expression.
esxcli system coredump partition listList diagnostic partitionsAlso marks which partition is active and which is configured for the next boot.
esxcli system coredump partition set --unconfigureDeactivate the diagnostic partitionSet a new partition straight away, because the host is left without one.
esxcli system coredump network set --interface-name vmk0 --server-ip 10xx.xx.xx.xx --server-port 6500Point core dumps at a collectorNames the VMkernel NIC plus the address and port of the dump collector.
esxcli system coredump network set --enable trueEnable network core dumps
esxcli system coredump network checkTest the dump collector setup
esxcli system coredump network getShow dump collector settings
esxcli system coredump file addCreate a core dump fileWith no options the system picks the datastore, a unique file name and a size that fits the host memory.
esxcli system coredump file listList core dump filesThe Active and Configured columns show whether a file is in use.
esxcli system coredump file set --smart --enable trueActivate a core dump file--smart lets the host choose the file with its own selection algorithm.
esxcli system snmp getShow SNMP agent settings
esxcli system snmp set -c publicSet SNMP communitiesSeparate several communities with commas; each run overwrites the earlier list.
esxcli system snmp set -t target.example.com@163/publicSet the SNMP trap targetThe format is address@port/community; traps go to UDP 162 when no port is given.
esxcli system snmp set --enable trueEnable the SNMP agent
esxcli system snmp testSend a test trapThe agent sends a warmStart trap to the configured target.
esxcli system auditrecords local enableEnable local audit records
esxcli system auditrecords remote enableSend audit records to syslog hosts
vm-supportCollect a support bundleWrites a .tgz with logs and configuration; look for it under /var/tmp.
vm-support -p -i INTERVAL -d DURATIONCollect performance snapshotsProduces the snapshots that esxtop plays back in replay mode.

Performance and packet capture 11

vmkping is taken from a Broadcom Knowledge Base article written for vSphere 7.x and 8.x; the 9.1 guides name the utility without printing a command line.

CommandWhat it does
esxtopStart esxtop interactivelyRuns only in the ESX Shell of the host and needs root privileges.
esxtop -b -a -d 10 -n 3Run esxtop in batch modeCollects all counters three times, ten seconds apart; redirect the output to a CSV file.
esxtop -hShow esxtop options
esxtop -R VM-SUPPORT_DIR_PATHReplay a vm-support snapshotOnly works with snapshots taken on the same ESX version.
esxcli network diag ping --host HOSTPing a network hostFurther options pick the outgoing interface, the packet count and the don't-fragment bit.
vmkping -I vmk0 x.x.x.x -s 1472 -d -c 3Test VMkernel connectivitySends three pings from vmk0 that must not be fragmented; the size is the MTU minus 28.
pktcap-uw -AList packet capture points
pktcap-uw --uplink vmnic0 --capture UplinkRcv --srcip 192.168.25.113 --outfile vmnic0_rcv_srcip.pcap --count 60Capture packets on an uplinkSaves the first 60 packets that vmnic0 receives from that source address to a pcap file.
pktcap-uw --switchport 33554481 --capture VnicRx --srcip 192.168.25.113 --outfile vmxnet3_rcv_srcip.pcap --count 60Capture packets at a VM portThe switch port ID identifies the virtual machine adapter.
pktcap-uw --vmk vmkXCapture on a VMkernel adapterWithout further options it shows the packets leaving the adapter.
pktcap-uw --capture DropCapture dropped packetsThe output also states why and where each packet was dropped.

vSAN 5

CommandWhat it does
esxcli vsan network listList vSAN VMkernel adapters
esxcli vsan storage listList disks claimed by vSANAdd --device to show a single disk.
esxcli vsan cluster getShow vSAN cluster membership
esxcli vsan cluster join --cluster-uuid UUIDJoin a vSAN cluster
esxcli vsan cluster leaveLeave the vSAN cluster

Notes

Host identity and health

esxcli system version get returns the product, version and build, the first thing support asks for, and esxcli system holds host name, time, maintenance mode, modules and advanced settings. A host must be in maintenance mode before esxcli system shutdown reboot will run, and the command insists on a reason. esxcli hardware cpu list and esxcli hardware memory get report the physical resources, and esxcli hardware goes on to PCI devices, IPMI sensors and the power policy. esxcli software lists installed VIBs and components and applies image profiles: esxcli software vib list before an upgrade, esxcli software profile update to bring the host to a profile from a depot.

VMs, network and storage

esxcli vm process list shows running VMs with their World IDs, and esxcli vm can stop a VM that no longer responds to vSphere: soft first, then hard, then force. esxcli network ip interface list shows VMkernel interfaces, and esxcli network goes on to vSwitches, port groups, firewall rule sets and NIC statistics, which is where a management-network mistake is fixed from the console. esxcli storage filesystem list lists datastores, mounted or not, and esxcli storage covers devices, paths, multipathing policies and NFS mounts; esxcli iscsi, esxcli nvme and esxcli vsan are the protocol-specific namespaces. Virtual disk files are handled by vmkfstools, not by esxcli.

Running esxcli remotely

The same command set runs from a Linux, Windows or macOS workstation once the standalone ESXCLI package is installed, and from PowerCLI through Get-EsxCli, so scripts written against the console work elsewhere. Remote runs put connection options such as --server before the namespace; a host in lockdown mode is reached through vCenter with --server and --vihost. Put --formatter=csv, xml or keyvalue before the namespace for output that scripts can parse. esxcli esxcli command list prints every command the host supports, which is the way to discover what a partner VIB has added. esxcli licensing manages license credentials and esxcli daemon controls daemons built with the Daemon SDK.

Questions

How do I find the ESXi version from the command line?

esxcli system version get. It prints the product name, version and build number.

How do I force-kill a hung VM?

Run esxcli vm process list to get the World ID, then esxcli vm process kill --type soft --world-id ID. If the VM is still running, repeat with hard, and use force only as the last resort.

How do I see all esxcli commands?

esxcli esxcli command list prints every command the host supports, including those a partner VIB has added. esxcli --help lists the namespaces.

Can I get machine-readable output?

Yes. Put --formatter=csv, --formatter=xml or --formatter=keyvalue directly after esxcli, before the namespace, as in esxcli --formatter=csv storage filesystem list.

How do I put an ESXi host into maintenance mode from the shell?

esxcli system maintenanceMode set --enable true. The host enters the mode once its virtual machines are suspended or migrated; esxcli system maintenanceMode get shows the current state.

Sources and checks

Every row on this page was matched to a line in the documentation above on . A binding that could not be found there is not listed.

Found a wrong or missing key? Tell us and it gets checked against the source. How we verify describes the process and its limits.