ESXi Commands

VMware ESXi CLI and esxcli commands for hypervisor management.

Host Startup Procedure

Step 1: Power on ESXi host

Boot the physical server

Step 2: Wait for host boot

Wait 3-5 minutes for ESXi to fully load

Step 3: Verify host status

Check host services are running

esxcli system version get

Verify ESXi version and build

/etc/init.d/hostd status

Check hostd service status

Step 4: VMs auto-start

VMs with auto-start enabled will boot automatically

vim-cmd vmsvc/getallvms

List all VMs and their states

Step 5: Verify vCenter connection

Ensure host reconnects to vCenter (if applicable)

Host Shutdown Procedure

Step 1: Put host in maintenance mode

Migrate or shutdown VMs via vCenter (if applicable)

vim-cmd hostsvc/maintenance_mode_enter

Enter maintenance mode

Step 2: Shutdown guest VMs

Gracefully shutdown all running VMs

vim-cmd vmsvc/getallvms | grep -v Vmid

List all VMs to get VMIDs

vim-cmd vmsvc/power.shutdown <vmid>

Graceful shutdown specific VM

for vm in $(vim-cmd vmsvc/getallvms | awk '{print $1}' | grep -v Vmid); do vim-cmd vmsvc/power.shutdown $vm; done

Shutdown all VMs

Step 3: Wait for VM shutdown

Allow VMs 2-5 minutes to shutdown gracefully

vim-cmd vmsvc/power.getstate <vmid>

Check VM power state

Step 4: Shutdown ESXi host

Power off the hypervisor

esxcli system shutdown poweroff -r "Scheduled maintenance"

Shutdown ESXi host

esxcli system shutdown reboot -r "Reboot for updates"

Reboot ESXi host

/sbin/shutdown.sh && /sbin/poweroff

Alternative shutdown command

System Information

esxcli system version get

Display ESXi version

esxcli hardware platform get

Display hardware platform info

esxcli system hostname get

Display hostname

esxcli system stats installtime get

Display installation time

esxcli system time get

Display current time

esxcli system uuid get

Display system UUID

vmware -v

Display VMware version (short)

uptime

Display system uptime

Virtual Machine Management

vim-cmd vmsvc/getallvms

List all VMs with VMIDs

vim-cmd vmsvc/power.getstate <vmid>

Get VM power state

vim-cmd vmsvc/power.on <vmid>

Power on VM

vim-cmd vmsvc/power.off <vmid>

Power off VM (hard)

vim-cmd vmsvc/power.shutdown <vmid>

Graceful shutdown VM

vim-cmd vmsvc/power.reboot <vmid>

Reboot VM

vim-cmd vmsvc/power.suspend <vmid>

Suspend VM

vim-cmd vmsvc/power.reset <vmid>

Reset VM (hard reboot)

vim-cmd vmsvc/get.summary <vmid>

Display VM summary

vim-cmd vmsvc/get.config <vmid>

Display VM configuration

vim-cmd vmsvc/snapshot.get <vmid>

List VM snapshots

vim-cmd vmsvc/snapshot.create <vmid> <name> <desc>

Create VM snapshot

vim-cmd vmsvc/snapshot.remove <vmid> <snapshot_id>

Delete VM snapshot

esxcli vm process list

List running VMs with world IDs

esxcli vm process kill -t soft -w <world_id>

Soft kill VM process

esxcli vm process kill -t hard -w <world_id>

Hard kill VM process

Network Configuration

esxcli network nic list

List physical NICs

esxcli network vswitch standard list

List virtual switches

esxcli network vswitch standard portgroup list

List port groups

esxcli network vswitch standard add -v <vswitch_name>

Create virtual switch

esxcli network vswitch standard uplink add -u <vmnic> -v <vswitch>

Add uplink to vSwitch

esxcli network vswitch standard portgroup add -p <name> -v <vswitch>

Add port group

esxcli network vswitch standard portgroup set -p <name> -v <vlan_id>

Set VLAN on port group

esxcli network ip interface list

List vmkernel interfaces

esxcli network ip interface ipv4 get

Display IPv4 configuration

esxcli network ip interface add -i <vmk#> -p <portgroup>

Add vmkernel interface

esxcli network ip interface ipv4 set -i <vmk#> -I <ip> -N <netmask>

Set vmkernel IP address

esxcli network ip route ipv4 list

Display routing table

esxcli network ip route ipv4 add -g <gateway> -n default

Add default gateway

esxcli network ip dns server list

Display DNS servers

esxcli network ip dns server add -s <dns_ip>

Add DNS server

esxcli network firewall get

Display firewall status

esxcli network firewall set --enabled true

Enable firewall

esxcli network firewall ruleset list

List firewall rulesets

esxcli network firewall ruleset set -r <ruleset> -e true

Enable firewall ruleset

Storage Management

esxcli storage core adapter list

List storage adapters

esxcli storage core device list

List storage devices

esxcli storage vmfs extent list

List VMFS extents

esxcli storage filesystem list

List datastores

esxcli storage nfs list

List NFS datastores

esxcli storage nfs add -H <nfs_server> -s <share> -v <datastore_name>

Mount NFS datastore

esxcli storage nfs remove -v <datastore_name>

Unmount NFS datastore

esxcli storage core device smart get -d <device>

Get SMART data for device

esxcli storage core path list

List storage paths

ls /vmfs/volumes/

List datastore mount points

vmkfstools -i <source.vmdk> <destination.vmdk>

Clone virtual disk

vmkfstools -c <size> <diskname.vmdk>

Create virtual disk

vmkfstools -X <newsize> <diskname.vmdk>

Expand virtual disk

Host Configuration

esxcli system hostname set --host <hostname> --fqdn <fqdn>

Set hostname

esxcli system ntp set --server <ntp_server>

Set NTP server

esxcli system ntp set --enabled true

Enable NTP

esxcli system ntp get

Display NTP configuration

esxcli system module list

List loaded kernel modules

esxcli system module set -m <module> -e true

Enable kernel module

esxcli system settings advanced list

List advanced settings

esxcli system settings advanced set -o <option> -i <value>

Set advanced setting

esxcli system syslog config get

Get syslog configuration

esxcli system syslog config set --loghost <syslog_server>

Set syslog server

esxcli system coredump partition get

Display coredump partition

esxcli system coredump network get

Display network coredump configuration

Service Management

/etc/init.d/hostd restart

Restart hostd service

/etc/init.d/vpxa restart

Restart vCenter agent

/etc/init.d/ntpd restart

Restart NTP service

esxcli system maintenanceMode get

Check maintenance mode status

esxcli system maintenanceMode set --enable true

Enter maintenance mode

esxcli system maintenanceMode set --enable false

Exit maintenance mode

esxcli system shutdown poweroff -d <delay> -r <reason>

Shutdown host

esxcli system shutdown reboot -d <delay> -r <reason>

Reboot host

User & Security

esxcli system account list

List local user accounts

esxcli system account add -i <username> -p <password> -c <password>

Add user account

esxcli system account set -i <username> -p <newpassword> -c <newpassword>

Change user password

esxcli system account remove -i <username>

Remove user account

esxcli system permission list

List permissions

vim-cmd hostsvc/advopt/view UserVars.ESXiShellTimeOut

View ESXi Shell timeout

vim-cmd hostsvc/advopt/update UserVars.ESXiShellTimeOut long <seconds>

Set ESXi Shell timeout

esxcli system security certificatestore list

List SSL certificates

Patches & Updates

esxcli software sources profile list -d /vmfs/volumes/<datastore>/<update.zip>

List profiles in update bundle

esxcli software sources profile list -d https://<url>/depot.zip

List profiles from online depot

esxcli software vib list

List installed VIBs

esxcli software vib install -v <vib_path>

Install VIB from file

esxcli software vib install -d <depot_url> -n <vib_name>

Install VIB from depot

esxcli software vib remove -n <vib_name>

Remove VIB

esxcli software vib update -d <bundle_path>

Update from offline bundle

esxcli software profile update -d <bundle> -p <profile>

Update to specific profile

esxcli software profile update -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p <profile>

Update from VMware online depot

esxcli software profile install -d <depot> -p <profile>

Install complete profile (clean install)

esxcli software acceptance get

Get acceptance level

esxcli software acceptance set --level CommunitySupported

Set acceptance level to community

esxcli software acceptance set --level PartnerSupported

Set acceptance level to partner

esxcli software acceptance set --level VMwareCertified

Set acceptance level to certified

esxcli software profile get

Display current installed profile

esxcli software vib list | grep -i <search>

Search installed VIBs

Firmware Updates

esxcli hardware platform get

Display hardware platform information

esxcli system baseline get

Display firmware baseline

esxcli hardware pci list

List PCI devices with firmware versions

esxcli network nic get -n <vmnic>

Display NIC firmware version

esxcli storage core adapter list

List storage adapters with firmware

sched-swap -s /vmfs/volumes/<datastore>/<firmware.zip>

Schedule firmware update (HPE)

esxcli software vib install -d /vmfs/volumes/<datastore>/<offline-bundle.zip>

Install driver/firmware bundle

esxcli hardware ipmi sel list

Display IPMI system event log

esxcli hardware ipmi fru list

Display field replaceable unit info

Monitoring & Logs

esxcli hardware cpu list

Display CPU information

esxcli hardware memory get

Display memory information

esxcli hardware pci list

List PCI devices

esxcli system stats installtime get

Display uptime statistics

esxtop

Interactive performance monitor

vsish

VMware system information shell

tail -f /var/log/vmkernel.log

Monitor vmkernel log

tail -f /var/log/hostd.log

Monitor hostd log

tail -f /var/log/vpxa.log

Monitor vCenter agent log

cat /var/log/messages

View system messages

vm-support

Generate support bundle

Advanced & Troubleshooting

esxcli system process list

List running processes

kill -9 <pid>

Kill process by PID

esxcli system visorfs get

Display visorfs ramdisk usage

vdf -h

Display datastore usage

esxcli system visorfs ramdisk list

List ramdisks

ping -c 4 <ip>

Ping network host

vmkping -I <vmk#> <ip>

Ping from specific vmkernel interface

esxcli network diag ping -H <host>

Network diagnostic ping

esxcli network ip connection list

Display network connections

esxcli rdma device list

List RDMA devices

localcli

Local CLI (works when hostd is down)