50 ESXCLI commands for managing an ESXi host

Managing an ESXi host effectively often involves using the command-line interface (CLI) and ESXCLI commands. Here, I’ll provide you with a list of 10 ESXCLI commands, but keep in mind that there are many more commands and options available for ESXi host administration.

 

Certainly, here are 50 ESXCLI commands for managing an ESXi host:

  1. List VMs on the Host:
    esxcli vms vm list
  2. Power On a VM:
    esxcli vms vm power on -v <VMID>
  3. Power Off a VM:
    esxcli vms vm power off -v <VMID>
  4. Create a VMFS Datastore:
    esxcli storage filesystem vmfs create -l <DatastoreName> -s <DatastoreSize> -p <StorageDevice>
  5. List Physical Network Adapters:
    esxcli network nic list
  6. Configure VMKernel IP Address:
    esxcli network ip interface ipv4 set -i <VMKernelName> -I <IPAddress> -N <SubnetMask> -t static
  7. Create a Port Group:
    esxcli network vswitch standard portgroup add -v <vSwitchName> -p <PortGroupName>
  8. Check ESXi Version:
    esxcli hardware platform get
  9. List Running Processes:
    esxcli hardware cpu list
  10. List Storage Devices:
    esxcli storage core device list
  11. Check Health Status of Physical NICs:
    esxcli network nic get -n <NICName>
  12. List Datastores:
    esxcli storage filesystem list
  13. Set NTP Server:
    esxcli hardware clock set --year <Year> --month <Month> --day <Day> --hour <Hour> --minute <Minute> --second <Second>
  14. List Host VMkernel Interfaces:
    esxcli network ip interface list
  15. Rescan Storage Adapters:
    esxcli storage core adapter rescan -A
  16. Add a User to ESXi Host:
    esxcli system account add -d <Username> -i <UserID> -p <Password>
  17. Check Firewall Status:
    esxcli network firewall get
  18. Set DNS Configuration:
    esxcli network ip dns search add --domain=<DomainName>
  19. List vSwitches:
    esxcli network vswitch standard list
  20. Reboot ESXi Host:
    reboot
  21. List VM Snapshots:
    esxcli vms vm snapshot list -v <VMID>
  22. Clone a VM Snapshot:
    esxcli vms vm snapshot clone -v <VMID> -s <SnapshotName> -n <NewSnapshotName>
  23. Remove a VM Snapshot:
    esxcli vms vm snapshot remove -v <VMID> -s <SnapshotName>
  24. List Datastore Paths:
    esxcli storage filesystem list -l
  25. Add a Static Route:
    esxcli network ip route ipv4 add -n <DestinationNetwork> -g <GatewayIP>
  26. List System Services:
    esxcli software vib list
  27. Install a VIB:
    esxcli software vib install -v <VIBPath>
  28. List Running VMs:
    esxcli vms vm list -q
  29. List Registered VMs:
    esxcli vms vm list -r
  30. Get VM CPU Affinity:
    esxcli vms vm get -v <VMID> -p cpuid
  31. List Host Services:
    esxcli software vib list
  32. Set Syslog Configuration:
    esxcli system syslog config set --loghost <SyslogServerIP>
  33. List USB Devices:
    esxcli hardware usb list
  34. Add VM to vApp:
    esxcli vms vm vapp add -v <VMID> -a <vAppName>
  35. Remove VM from vApp:
    esxcli vms vm vapp remove -v <VMID> -a <vAppName>
  36. Create a VM on ESXi:
    esxcli vms vm create -v <VMName> -l <DatastoreName> -t <VMTemplate>
  37. List Routed VMKernel Interfaces:
    esxcli network ip interface ipv4 list -r
  38. Migrate VM to Different Datastore:
    esxcli vms vm migration start -v <VMID> -d <DestinationDatastore>
  39. List Installed VIBs:
    esxcli software vib list
  40. Enable/Disable SSH Access:
    esxcli network firewall ruleset set -e true/false -r sshClient
  41. List VM Advanced Options:
    esxcli vms vm advanced get -v <VMID>
  42. Set VM Advanced Option:
    esxcli vms vm advanced set -v <VMID> -o <OptionName> -v <OptionValue>
  43. Check HBA Adapters:
    esxcli storage core adapter list
  44. List Host Sensors:
    esxcli hardware ipmi sel list
  45. Configure VM CPU Affinity:
    esxcli vms vm set -v <VMID> -p cpuid -c <CPUs>
  46. List NFS Datastores:
    esxcli storage nfs list
  47. List Datastore Paths:
    esxcli storage filesystem list -l
  48. List iSCSI Software Adapters:
    esxcli iscsi adapter list
  49. Discover iSCSI Targets:
    esxcli iscsi adapter discovery sendtarget -a <iSCSITargetIP>
  50. List iSCSI Sessions:
    esxcli iscsi session list

Loading