Deleting Virtual Machine fails "Invalid virtual machine state"
search cancel

Deleting Virtual Machine fails "Invalid virtual machine state"

book

Article ID: 376405

calendar_today

Updated On:

Products

VMware vSphere ESXi VMware vSphere ESX 8.x VMware vSphere ESX 7.x

Issue/Introduction

Trying to delete the VM fails with Error- "Invalid virtual machine state"

Hard disk on the VM reflects "0" MB

Environment

ESXi 7.x

ESXi 8.x

Cause

This is observed when the vmdk is manually deleted from the datastore 

Resolution

Disclaimer: Ensure that the VM's directory does not contain any flat.vmdk, vmdk or delta disk files. Verify this with the customer and follow the steps outlined below:

Note: These Steps are to be followed only if the VMDK was deleted from Datastore and the VM is no longer required. 

  1. Navigated to Edit Setting of the VM
  2. Remove the Attached Hard Disk reflecting "0" MB and click Save
  3. The Re-configuration Task Might fail with Error- vmdk not found  "Cause- VMDK was deleted from the datastore"
    • Recheck the disk in edit setting and it should no longer reflect (This is a Stale Entry in vmx file) 
    • Right-click the virtual machine in the Inventory and select Delete VM.
      • Click Yes to delete the virtual machine.
    • The VM should be deleted successfully.

Additional Information

Note: If VM has multiple Disks in place and if we need to delete or remove single VMDK, the operation should be carried out from the vCenter or Host VM UI Edit Setting and not the Datastore Level.