Unable to delete a virtual machine via vCenter GUI
search cancel

Unable to delete a virtual machine via vCenter GUI

book

Article ID: 441420

calendar_today

Updated On:

Products

VMware vSphere ESX 8.x

Issue/Introduction

When attempting to delete a virtual machine from the vCenter GUI, you may observe one or more of the following behaviours:

  • When selecting Edit Settings for the virtual machine, the error “Data capacity cannot be zero” is displayed against one or more virtual disks.
  • The VM delete task fails, becomes stuck, or does not complete successfully.

 

Environment

VMware vSphere ESXi 8.x/9.x

Cause

In a standard vSphere environment, virtual machines are typically managed via the vSphere Client connected to vCenter Server. However, in certain scenarios—such as standalone host management, troubleshooting vCenter connectivity issues, or decommissioning specific local resources—it is necessary to delete a VM directly via the VMware Host Client.

Resolution

Users may need to perform this action directly on the host if the vCenter Server is unavailable, or if specific management tasks require local host interaction.

Warning: Deleting a virtual machine is a permanent action that removes the VM configuration (.vmx) and all virtual disks (.vmdk) from the datastore. Ensure you have a valid backup of any required data before proceeding.

  1. Access the Host Client:
    • Open a web browser and navigate to the ESXi host URL: https://<ESXi-IP-Address-or-FQDN>/ui.
    • Log in with administrative credentials (e.g., root).
  2. Verify Power State:
    • In the Navigator pane, select Virtual Machines.
    • Ensure the target virtual machine is Powered Off. The delete option is disabled (greyed out) if the VM is running or suspended.
  3. Delete the Virtual Machine:
    • Right-click the virtual machine name in the inventory list.
    • Select Delete from the context menu.
  4. Confirm the Action:
    • A confirmation window will appear stating that the virtual machine and all its associated files will be permanently deleted.
    • Click Delete to confirm.
  5. Monitor Progress:
    • Verify the "Delete virtual machine" task completes successfully in the Recent Tasks pane at the bottom of the screen.

Additional Information

    • Delete vs. Unregister: In the VMware Host Client, selecting Delete performs a "Delete from Disk," removing both the inventory registration and the physical files. If you only wish to remove the VM from the list while keeping the files on the datastore, use the Unregister option (found under actions or right-click menu).
    • Permissions: If the "Delete" option remains greyed out while the VM is powered off, verify that the user account has sufficient permissions (e.g., Administrator role) and that no third-party software (such as backup or replication agents) has placed a lock on the VM configuration.

    • Troubleshooting: If the deletion fails with an "Invalid virtual machine state" error, it may indicate a missing disk descriptor file as described in KB Deleting Virtual Machine fails "Invalid virtual machine state"