• Virtual Machines show as invalid or orphaned in vCenter Server
  • Virtual Machines show as invalid or orphaned after a VMware High Availability (VMware HA) host failure occurs
  • Virtual Machines show as invalid or orphaned after an ESX host comes out of maintenance mode
  • Virtual Machines show as invalid or orphaned after a failed DRS migration
  • Virtual Machines show as invalid or orphaned after a storage failure
  • Virtual Machines show as invalid or orphaned after the connection is lost between the vCenter Server and the host where the virtual machine resides
  • You see one or more of these errors when trying to start a virtual machine:

Could not power VM, no swap file, failed to power on VM.
VMControl error -11: No such virtual machine.
A general system error occurred. The system returned on error. Communication with the virtual machine may have been interrupted

Virtual machine

Possible Cause

  • A virtual machine can show up as invalid or orphaned in these situations.
  • After a vMotion or VMware DRS migration.
  • After a VMware HA host failure occurs, or after the ESX host comes out of maintenance mode.
  • A virtual machine is deleted outside of vCenter Server.
  • vCenter Server is restarted while a migration is in progress.
  • Too many virtual machines are scheduled to be relocated at the same time.
  • Attempting to delete virtual machines when an ESX/ESXi host local disk (particularly the root partition) has become full.
  • Rebooting the host within 1 hour of moving or powering on virtual machines.
  • A .vmx file contains special characters or incomplete line item entries.
  • Reload all invalid virtual machines on a single host at one time.
  • vCenter database is full.


To unregister a VM using VIM command.

Log in through SSH client (putty) and run below command.

By default SSH disable on ESXi server. Follow these steps to enable SSH or skip this if already enabled.

a.) ProcedureSelect the host, click Manage, and keep Settings selected.

b.) Click Security Profile.

c.) In the Services section, click Edit.

d.) Select SSH.

  a. To temporarily start or stop the service, click the Start or Stop button.

        b. To change the Startup policy across reboots, select Start and stop with  host and reboot the host

e.) Click OK. SSH command : vim-cmd /vmsvc/unregister <Vmid>## put VMID of the invalid VM which has to be removed.
To get VMID run this command, this command will list all

VMIDsvim-cmd vmsvc/getallvms

8 Replies to “How To Remove Invalid VMs From ESXi Using CLI”

  1. Thanks for the tips. I needed the following command to display the VMID of the invalid VM:
    vim-cmd vmsvc/getallvms includeConfigNotAvailable

  2. It is the best time to make a few plans for the future and it’s time to be happy. I’ve read this submit and if I may just I want to recommend you few attention-grabbing things or advice.I wish to read even more things approximately it.

Leave a Reply

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

+ 2 = 5