Ticker

6/recent/ticker-posts

Advertisement

VMware ESXi commands

VMware ESXi provides a command-line interface (CLI) for managing and configuring ESXi hosts. Below are some of the most common ESXi commands for managing and troubleshooting:

1. Login to ESXi Host

You can access the ESXi shell via SSH or through the direct console user interface (DCUI).

To log in via SSH:

ssh root@<esxi_host_ip>

2. Check ESXi Version

To check the version of your ESXi host:

vmware -v

Output example:

VMware ESXi 7.0.0 build-12345678

3. List Virtual Machines on the Host

To list all virtual machines running on the ESXi host:

vim-cmd vmsvc/getallvms

Example output:

Vmid   Name      File        Path             Status

1      VM1       [datastore1] VM1.vmx           poweredOn

2      VM2       [datastore1] VM2.vmx           poweredOff

4. Power On/Off a Virtual Machine

To power on a VM:

vim-cmd vmsvc/power.on <vmid>

To power off a VM:

vim-cmd vmsvc/power.off <vmid>

5. Check System Resources

To check CPU, memory, and disk usage on the host:

esxtop

Press q to exit.

6. Check Network Configuration

To view the network configuration of your ESXi host:

esxcli network ip interface list

7. Check Host Storage

To view all storage devices on the ESXi host:

esxcli storage core device list

8. List All Datastores

To list all datastores available on the host:

esxcli storage filesystem list

9. Check Host Hardware Information

To view detailed hardware information:

esxcli system hardware platform

10. Reboot the ESXi Host

To reboot the ESXi host from the command line:

reboot

11. Upgrade ESXi Host

To update or upgrade ESXi using the ESXCLI:

esxcli system image update --url <URL_to_ESXi_image>

12. Rescan Storage Adapters

To rescan storage adapters for new devices (e.g., after adding a new disk):

esxcli storage core adapter rescan --adapter <adapter_name>

13. Enable/Disable SSH Access

To enable SSH on the ESXi host:

/etc/init.d/ssh start

To disable SSH access:

/etc/init.d/ssh stop

14. Check Firewall Status

To check the status of the ESXi firewall:

esxcli network firewall ruleset list

15. Access ESXi Logs

The log files can be found in /var/log/ directory. For example:

cat /var/log/vmkernel.log

16. Check ESXi Host Time

To check the time on the ESXi host:

esxcli system time get

17. List ESXi Host Services

To list all services running on the ESXi host:

services.sh status

18. Restart the Management Agent

If you face issues with the ESXi host management, you can restart the management agents:

services.sh restart

19. Check VMkernel Adapter Configuration

To check the VMkernel adapters (for iSCSI, NFS, etc.):

esxcli network ip interface ipv4 list

20. Check ESXi Host for License Information

To check the license information of the ESXi host:

vim-cmd vimsvc/license --show

Summary:

The VMware ESXi command-line interface provides a wide range of commands for system administrators to manage virtual machines, monitor system resources, configure storage and network settings, and perform troubleshooting. Many commands use the vim-cmd or esxcli utilities, and others interact directly with the ESXi shell environment.

Post a Comment

0 Comments