- Connect to the ESXi host using an SSH session and root credentials.
- Find the path where the VM configuration file (.vmx) resides:
- Find the VM in the vmInventory.xml:
cat /etc/vmware/hostd/vmInventory.xml |grep -i vm_name |grep vmx
For example:
[root@ESXiHostname:~] cat /etc/vmware/hostd/vmInventory.xml | grep -i VM_name | grep vmx
<vmxCfgPath>/vmfs/volumes/Datastore-UUID/VM_name/
VM_name.vmx</vmxCfgPath>
The file path is highlighted in yellow, and the VM configuration file name (*.vmx) is highlighted in blue
vim-cmd vmsvc/getallvms |grep -i vm_name
- Navigate to the VM directory from step 2:
cd configuration_file_path
- Run this command to get the names of the virtual disk files currently attached to the VM:
cat VM_name.vmx |grep fileName
Notes:
-
- 'fileName' is the syntax keyword.
- The output will also include such other devices as virtual floppy disks and virtual DVD/CDROMs
- Virtual disks may not be located in the same location as the .vmx file.
5. Run this command to check if a displayName is set or not:
cat VM_name.vmx|grep displayName