Showing posts with label ESXCLI. Show all posts

Find the Serial Number of VMware ESXi Host using CLI


There are multiple ways to find the serial number of the ESXi Host. Check the Serial Number physically inscribed on the server. It may or may not be present in the Configuration Tab of the ESXi Host when checked from vCenter Console.

It may not be always available in the configuration tab and in order to find the serial number of a Host, we can fetch the details like Make\Model and Serial No from SSH.

1. Open Putty and connect to the ESXi SSH console using root account credentials
2. Run the following command to get the serial no
                            esxcli hardware platform get
3. We get the required details as shown below


Kill VM Stuck Due To Running Tasks


Virtual Machines are sometimes hung due to active actions like Snapshot Collection, Removal, Disk Consolidation or other tasks. In these cases we usually wait until the tasks are completed on its own. However in some cases we do not see the progress in the Task.

In order to kill the ongoing task, we need to kill the VM process. Please note that this process also powers off the Virtual Machine and is not always recommended as it abruptly terminates the IOPS but if there are no other options and if we cannot wait any longer, we can use the following steps to kill the VM

1. Check the ESXi host on which this VM is hosted
2. Enable SSH on the host from Security Profiles
3. Connect to ESXi Host via SSH [You can use Putty to connect] using root credentials
4. Run the below command to list the running Virtual Machines and their World IDs

          esxcli vm process list

5. Locate the VM that you need to kill and note down the World ID
6. Kill the VM and its tasks by running the following command

          esxcli vm process kill --type=[soft, hard, force] --world-id=[world-id]

where type would be either soft, hard or force kill
& world-id is World ID of the VM that we noted down in Step#4