VMware ESXi – how to list virtual machines.
- February 17th, 2011
- Posted in Documentation
- Write comment
To list the virtual machines installed on a VMWare ESXi server, loging to the server via ssh and enter the following command:
~ # esxcli vms vm list
VMDC1
World ID: 9375350
Process ID: 0
VMX Cartel ID: 9375349
UUID: 56 4d 7e ca e0 c8 15 17-53 2e 21 de 2f 57 6b f0
Display Name: VMDC1
Config File: /vmfs/volumes/4cd70f88-eac98d60-3346-b8ac6f907086/VMDC1/VMDC1.vmx
There are several other options to the esxcli command, but another potentially useful option is the following command used to kill a hung VM:
~ # esxcli vms vm kill
~ # esxcli vms vm kill –type soft|hard|force –world-id World ID
Vim-cmd will also list the VMs. I have run into a situation where the ghettoVCB script will not work to backup VMs unless I refer to them by their “Vmid” which I have only been able to find using the following command:
vim-cmd vmsvc/getallvms
There are a number of other options to the vim-cmd command as well. If you enter the command, you will get a list of the options.
I tried the esxcli command on an ESXi 4.0 but I receive an error mesage “Unknown Namespace vms”. It works OK on another box… an ESXi 4.1.
The vim-cmd works fine on both 4.0 and 4.1.
We actually like our VMs’ names to contain last parts of static IPs, ie a VM called something near “ETL-SRC (.219)”. I then edit the ghettoVCB’s vms_to_backup file with:
VM1_to_backup
VM2_to_backup
ETL-SRC\ \(\.219\)
I believe you just had some characters to escape and might not have to enter Vmids in your input file anymore?
Thanks for your post 🙂
Thanks for the update. It has been quite an experience working with ESXi. The documentation is very hit and miss with the changes between versions.