How to kill a Vmware Guest using Esxi Cli on 4.x/5.x


Kill a Vmware Guest via SSH

1. First you should ensure your ESXi server has SSH enabled. On vSphere client open the server configuration tab, under Software select Security Profile.
2. Under Services > Properties > SSH > Click Options
3. Start the service and click OK
esxi-service
4. SSH into your Vmware server using root
5. To get a list of running virtual machines, enter the following to obtain the VM identified by World ID, UUID and path to the vmx:

On ESXi 5.1

esxcli vm process list

On ESXi 4.1

esxcli vms process list

6. If you have a very long list of VMs the command will not display the entire list and will likely end somewhere in between. In order to kill the guest you must obtain the World ID of the guest you wish to kill. The following command will search for the guest name you specify and display the trailing 6 lines of text following the guest name:

On ESXi 5.1

esxcli vm process list | grep -i guest_name -A 6

On ESXi 4.1

esxcli vms process list | grep -i guest_name -A 6
CentOSx64-AT01
World ID: 14767058
Process ID: 0
VMX Cartel ID: 14754769
UUID: 56 4d 6c 7c 8a 41 6d bb-e3 14 11 62 e9 37 e0 29
Display Name: CentOSx64-AT01
Config File: /vmfs/volumes/4f3999b9-e2fbbcad-ef78-1cc1dee7d12e/CentOSx64-AT01/CentOSx64-AT01.vmx

7. Next take the WORLD ID obtained in the previous step and kill the guest:

On ESXi 5.1

esxcli vm process kill --type=force --world-id=14767058

On ESXi 4.1

esxcli vms process kill --type=force --world-id=14767058

Kill a Vmware Guest via Local Shell

If all you have is access to the local shell you must enable ESXi Shell Access directly via the console
1. At the console of the ESXi host, press F2 and enter your root username and password
2. Scroll to the Troubleshooting options
3. Choose Enable ESXi Shell and press enter
4. ESC all the way out to the console screen
5. Entering ALT-F1 will put you onto the console screen prompting you for the username and password.
6. Follow the same instructions listed above to kill your VMware guest.

Related Posts with Thumbnails

About the Author

Alfred Tong
Author and owner of this blog. A Networking enthusiast, full time networking and systems Engineer. Generally curious about all things IT.Certifications: GIAC GSEC, CCNP-S, CCNP, CCSP, CCDP, CCNA, RHCE, JNCIA - FWV