Before You Begin
Run these commands directly in the ESXi Shell or an SSH session to the ESXi host, using an account with the necessary privileges. They are not commands for a Linux guest, Windows PowerShell, or the vCenter Server appliance.
Use this article as a reference, not as a script to run from top to bottom. Replace example addresses, interface names, and VM_ID with values from your host. Command availability can vary by ESXi release; check local help before changing settings:
esxcli system version get
esxcli --help
esxcli network ip interface ipv4 set --help
vim-cmd help vmsvc/snapshot.create
Host Information
esxcli system version get
esxcli system hostname get
esxcli hardware platform get
esxcli hardware cpu list
For an extensive host configuration report:
esxcfg-info -a
Network Configuration
Inspect Interfaces and Routes
esxcli network nic list
esxcli network nic get --nic-name=vmnic0
esxcli network ip interface list
esxcli network ip interface ipv4 get
esxcli network ip route ipv4 list
vmnic0 identifies a physical adapter. vmk0 identifies a VMkernel interface. They serve different purposes. The legacy esxcfg-nics -l command can also list physical adapters. See the network command reference.
Set a Static VMkernel Address
Changing the management interface address can disconnect SSH and the Host Client. Have local or out-of-band console access available and record the existing configuration first.
esxcli network ip interface ipv4 set --interface-name=vmk0 --ipv4=192.168.1.20 --netmask=255.255.255.0 --type=static
This example changes the address and mask of an existing interface. It does not create a port group, configure a VLAN, or update DNS and routing. Verify those separately, especially when moving to another subnet.
esxcli network ip interface ipv4 get --interface-name=vmk0
esxcli network ip route ipv4 list
vmkping -I vmk0 192.168.1.1
Use your actual gateway address for the connectivity check.
Disable or Enable a Physical Adapter
Confirm the adapter’s role before changing it. Disabling an uplink can interrupt management, VM traffic, or storage connectivity.
Disable the selected adapter:
esxcli network nic down --nic-name=vmnic1
Enable it again:
esxcli network nic up --nic-name=vmnic1
esxcli network nic list
These commands replace the original notes’ esxcfg-nics --enable and --disable examples. See Broadcom’s adapter troubleshooting guidance.
Storage and Datastores
Inspect Storage
esxcli storage core adapter list
esxcli storage core device list
esxcli storage filesystem list
esxcli storage nfs list
esxcli storage nfs41 list
Mount an NFS 3 Datastore
Configure the NFS server’s export permissions for the ESXi host first. Replace the server address, exported path, and datastore name:
esxcli storage nfs add --host=192.168.1.30 --share=/exports/esxi --volume-name=nfs-datastore
esxcli storage nfs list
esxcli storage filesystem list
storage nfs manages NFS 3; NFS 4.1 uses the separate storage nfs41 namespace. Match the command to the export protocol. See the storage command reference.
Virtual Machine Management
Find the VM ID
vim-cmd vmsvc/getallvms
Identify the correct VM by both its name and datastore path. Replace VM_ID below with the numeric ID returned by this host.
Check Power State and Start a VM
vim-cmd vmsvc/power.getstate VM_ID
vim-cmd vmsvc/power.on VM_ID
Shut Down a Guest Gracefully
vim-cmd vmsvc/power.shutdown VM_ID
vim-cmd vmsvc/power.getstate VM_ID
Guest shutdown requires working VMware Tools or open-vm-tools. Allow the guest time to shut down before checking again.
Force a VM Off
Use this only when an immediate power-off is intended or graceful shutdown has failed. It can lose unsaved guest data:
vim-cmd vmsvc/power.off VM_ID
See Broadcom’s VM power troubleshooting procedure.
Snapshots
Create a snapshot without guest memory and without filesystem quiescing:
vim-cmd vmsvc/snapshot.create VM_ID "before-maintenance" "Before configuration changes" 0 0
vim-cmd vmsvc/snapshot.get VM_ID
The final arguments are includeMemory and quiesced. Both are disabled in this example. For a running VM, this does not provide an application-consistent backup. Keep enough datastore space and remove temporary snapshots through normal snapshot management when finished. See the snapshot command guidance.
Unregister or Delete a VM
Unregistering removes a VM from the host inventory while retaining its files:
vim-cmd vmsvc/unregister VM_ID
Destroying deletes the VM and its associated files. Verify the VM ID, shut it down, and confirm any required backup before running:
vim-cmd vmsvc/destroy VM_ID
Choose the operation you actually intend; do not run both as a sequence. See Broadcom’s VM command comparison.
Management Services
Check service status:
/etc/init.d/hostd status
/etc/init.d/vpxa status
hostd handles local host management; vpxa connects a managed host to vCenter. A standalone host may not have an active vCenter agent.
When troubleshooting an unresponsive management service, restart only the affected service:
/etc/init.d/hostd restart
Or, for the vCenter agent:
/etc/init.d/vpxa restart
Expect a temporary management disconnect and possible disruption to active management tasks. Review cluster-specific restrictions for vSAN, NSX, and LACP before proceeding. Broadcom cautions against broad restarts through services.sh restart or DCUI’s management-agent restart in these environments. See Restarting management agents.
Local Accounts
List local accounts and current shell sessions:
esxcli system account list
who
Create an account using the correct system account namespace:
esxcli system account add --id=operator1 --password='REPLACE_WITH_PASSWORD' --password-confirmation='REPLACE_WITH_PASSWORD' --description='Operations user'
Replace both password placeholders with the same strong password. Command-line passwords can be exposed in history or logging; the Host Client provides an alternative for interactive account creation. Creating an account does not automatically assign an administrator role. Configure the required permissions separately. See the system command reference.
Logs and Performance
tail -n 100 /var/log/vmkernel.log
tail -n 100 /var/log/hostd.log
tail -n 100 /var/log/vpxa.log
tail -f /var/log/vmkernel.log
Press Ctrl+C to stop following a log.
esxtop
Use c for CPU, m for memory, n for networking, and q to quit.
Host Maintenance and Shutdown
Migrate or gracefully shut down the host’s VMs before maintenance. For a vSAN cluster, use its maintenance workflow and appropriate data-migration option rather than applying a generic command without reviewing storage impact.
Enter maintenance mode and verify its state:
esxcli system maintenanceMode set --enable=true
esxcli system maintenanceMode get
After maintenance mode is confirmed, choose one action.
Reboot:
esxcli system shutdown reboot --delay=60 --reason='Planned maintenance'
Or power off:
esxcli system shutdown poweroff --delay=60 --reason='Planned shutdown'
After the host returns and checks are complete, exit maintenance mode:
esxcli system maintenanceMode set --enable=false
The ESXCLI shutdown commands require maintenance mode. See the system command reference.
Direct Console Interface
From a supported interactive ESXi shell session:
dcui
The physical or out-of-band console remains useful when a network change disconnects SSH. Disable temporary ESXi Shell or SSH access when troubleshooting is complete, according to your host access policy.