VMware vSphere is a powerful virtualization platform used by organizations to run and manage their virtual infrastructure. While the vSphere web client provides a user-friendly interface for managing virtual machines and hosts, there are times when troubleshooting requires a deeper level of access and control. In such cases, the VMware Command-Line Interface (CLI) becomes an invaluable tool. In this blog post, we will explore some of the most useful VMware CLI commands that can aid in troubleshooting VMware vSphere infrastructure.
In the past, I have wrote some blog posts about useful CLI commands and you might be interested in those. Let's have a look here:
- ESXi Commands List – Getting started
- ESXi CLI Networking commands
- ESXi Commands List – Snapshot Deletion Monitoring
- ESXi Commands List – Storage
As you can see, the
esxcli command is a versatile and powerful command-line tool that provides access to various aspects of the ESXi host or vCenter. It allows you to perform a wide range of tasks, including network configuration, storage management, and performance monitoring. Some essential
esxcli commands for troubleshooting include:
esxcli network– Provides network-related commands such as listing network interfaces, configuring VLANs, and troubleshooting network connectivity.
esxcli storage– Allows you to manage storage devices, view storage information, and troubleshoot storage-related issues.
esxcli system– Provides system-related commands such as managing services, checking hardware health, and monitoring system resources.
vim-cmd command is another powerful tool that allows you to interact with the vSphere API and perform various operations on virtual machines and hosts. It is particularly useful for managing virtual machines and troubleshooting issues related to them. Some essential
vim-cmd commands for troubleshooting include:
vim-cmd vmsvc/getallvms– Lists all virtual machines along with their IDs, names, and power states.
vim-cmd vmsvc/power.on <vmid>– Powers on a virtual machine with the specified ID.
vim-cmd vmsvc/device.getdevices <vmid>– Retrieves information about the devices attached to a virtual machine.
vicfg- commands are a set of commands used for managing ESX and ESXi hosts. They provide low-level access to host configuration settings and can be useful for troubleshooting issues related to host configuration. Some essential
vicfg- commands for troubleshooting include:
vicfg-nics– Lists network interfaces and their configuration settings.
vicfg-route– Manages routing table entries on the host.
vicfg-vmknic– Manages VMkernel network interfaces.
Can be run against ESXi systems or against a vCenter Server system.
esxcli system version get
Will returns the ESXi build and version numbers.
esxcli system stats installtime get
Will give you a date and time of when ESXi was installed. (when upgrading an older systems, this might be interesting to know).
esxcli system account list
Will give you a list of the local users that are currently on your ESXi host.
esxcli system maintenanceMode set –enable true
Very useful command that is used to put your ESXi in maintenance mode (or take it out from maintenance mode).
esxcli system shutdown reboot -d 10 -r “Installation of Updates”
This command is used to reboot or shutdown ESXi host where -d parameter is a countdown time. The minimum is 10 seconds. ESXi has to be in maintenance mode before you can use the command so use it in conjunction with the command just before this one.
esxcli storage filesystem list
Check your storage attached to your ESXi host. This command lists of all the volumes or datastores accessible by your ESXi host. The output shows the file system type, disk info along with the volume name, path and UUID.
similarly this one which provides more details about VMware nmp: (By default, ESXi provides an extensible multipathing module called Native Multipathing Plug-In (NMP). Generally, the VMware NMP supports all storage arrays listed on the VMware storage HCL and provides a default path selection algorithm based on the array type. The NMP associates a set of physical paths with a specific storage device, or LUN. For additional multipathing operations, the NMP uses submodules, called SATPs and PSPs. The NMP delegates to the SATP the specific details of handling path failover for the device. The PSP handles path selection for the device.)
esxcli storage nmp device list
When it comes to troubleshooting VMware vSphere infrastructure, having a good understanding of the VMware CLI commands can greatly enhance your troubleshooting capabilities. The
vicfg- commands provide access to various aspects of the virtual infrastructure, allowing you to diagnose and resolve issues efficiently. By familiarizing yourself with these essential VMware CLI commands, you can become a more effective troubleshooter and gain better control over your VMware vSphere environment.
- VMware vCenter Server 8.0 U1b resolves further upgrade issues and adds bunch of security patches
- VMware vCenter Server Appliance 8.0U1a Released
- VMware vSphere 8.0 U1 Announced
- VMware vSAN 8.0 U1 What's New?
- vSphere 8.0 Page
- Veeam Bare Metal Recovery Without using USB Stick (TIP)
- ESXi 7.x to 8.x upgrade scenarios
- A really FREE VPN that doesn’t suck
- Patch your ESXi 7.x again
- VMware vCenter Server 7.03 U3g – Download and patch
- Upgrade VMware ESXi to 7.0 U3 via command line
- VMware vCenter Server 7.0 U3e released – another maintenance release fixing vSphere with Tanzu
- What is The Difference between VMware vSphere, ESXi and vCenter
- How to Configure VMware High Availability (HA) Cluster
- Homelab v 8.0