Delete VM off ESXi Host with limited connectivity

So you’ve found yourself in a situation where you cant access a box with the VMWare C# client, restarting services doesnt fix the issue, and you need to delete/remove a VM? Here’s your hack-jobby-solution of the day.

What you’ll need:
1. iLO, DRAC, or console access
2. root/admin
3. WinSCP
4. Putty

So, all of this assumes you have network connectivity to the system. First things first…
1. Lets enable SSH/Putty access to the system. Via your iLO/DRAC/Etc – logon to the console of the system, login, F2, authenticate, Troubleshooting options, enable ESXI Shell and SSH
(iLO and iLO2 require IE with compatability mode and Enhanced Security disabled – make sure to turn this back on when complete)
2. For ESX 5.5 to 5.5 type : vim-cmd vmsvc/getallvms to list the VMs on this host. Find your VM, and take note of its VMID
3. Get the power state of your soon to be doomed vm : vim-cmd /vmsvc/power.getstate VMIDHERE (Make sure its off)
4. Un-register the VM : vim-cmd /vmsvc/unregister VMIDHERE
5. Now login to the ESX host via WinSCP, browse to the datastore that houses the VM, look for the folder with the name of the VM, and delete it.


Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Bitnami banner