Skip to main content
Home/Blog/How to Fix Invalid VMs in vCenter: Step-by-Step Guide
Virtualization

How to Fix Invalid VMs in vCenter: Step-by-Step Guide

Complete guide to troubleshoot and fix invalid virtual machines in vCenter. Learn re-registration, datastore fixes, and permanent solutions to resolve VM errors.

How to Fix Invalid VMs in vCenter: Step-by-Step Guide

A VM shows as "(invalid)" in vCenter when the platform can still see it in inventory but can no longer read its configuration file (the .vmx) — almost always because the datastore holding it became inaccessible or the ESXi host that owns it disconnected. The VM's files are usually intact; the fix is to restore host and datastore access, reload the VM's configuration on the host with vim-cmd vmsvc/reload, and — if that fails — remove it from inventory (without deleting files) and re-register the .vmx. A closely related state, "(orphaned)", means vCenter's database and the ESXi host disagree about the VM and is fixed the same way, by re-registering.

That is the summary an AI overview will give you. What it can't give you is the part that actually saves the VM: knowing which of the two states you're looking at, working the diagnosis from host to datastore to registration in the right order, and doing it without running "Delete from Disk" by mistake. This guide walks through the diagnosis, the exact commands, and the storage-recovery steps — plus how to stop it happening again.

Understanding Invalid VM Status

When a virtual machine is marked as "Invalid" in vCenter, it indicates that vCenter is unable to retrieve the VM's configuration or metadata, making it unmanageable from the vSphere interface. The VM greys out and its power controls stop responding — but this is a management-plane problem, not proof that the VM itself is damaged.

It helps to separate the two states you'll actually encounter:

  • Invalid — vCenter sees the VM but cannot read its .vmx. Cause is usually an inaccessible datastore or a disconnected host. The VM's files are typically fine once access returns.
  • Orphaned — vCenter's database still lists the VM, but the ESXi host no longer reports owning it. The two sides disagree. Common after a host crash, an HA failover, or a VM being re-registered directly on the host.

Common Causes

  • vCenter and ESXi Host Communication Issues: Network disruptions, host failures, or vCenter service issues
  • Corrupt or Missing VM Configuration Files: .vmx and .vmdk files may become corrupted or deleted
  • Datastore Inaccessibility: Storage failures, disconnected datastores, or insufficient space
  • Permissions Issues: vCenter or ESXi lacking sufficient permissions to access VM files
  • Host Disconnections: ESXi host goes offline, crashes, or enters maintenance mode

The Recovery Path at a Glance

Work the problem from the outside in — restore access first, reload second, re-register last. Jumping straight to re-registration before the datastore is back can leave you chasing a problem that fixes itself once storage returns.

Invalid VM recovery flow Four ordered steps: a VM shows invalid or orphaned, check the host and datastore, reload the VM via the ESXi command line, then remove and re-register the .vmx if needed. A marker travels left to right along the path. Invalid VM recovery: outside in VM: (invalid) or (orphaned) Check host + datastore Reload via vim-cmd Re-register .vmx Restore access first · reload second · re-register only if still broken

Symptom → Cause → Fix

Match what vCenter is showing you to the underlying cause before you touch anything. Most "invalid" tickets are solved by the first two rows.

Symptom in vCenterMost likely causeFix
VM greyed out, labeled (invalid)vCenter can't read the .vmx — datastore inaccessible or host disconnectedReconnect host / remount datastore, then reload the VM
VM labeled (orphaned)vCenter database and ESXi host disagree (often after a host crash or HA failover)Remove from inventory (keep files), then re-register the .vmx
Every VM on one host goes invalid at onceThe ESXi host disconnected from vCenterRight-click host → Connection → Connect; check management network
VMs went invalid after a storage outageDatastore was unmounted or hit all-paths-down (APD)Remount the datastore, restart storage services, reload the VMs
VM stays invalid after the host reconnectsStale VM state cached in host memoryvim-cmd vmsvc/reload <vmid> on the ESXi host
"Register VM" fails or .vmx is missing.vmx corrupt or deletedRestore from backup, or recreate the VM and attach the existing .vmdk

Step-by-Step Troubleshooting

Option 1: Reload the VM

If the VM appears in the ESXi inventory but is invalid, try reloading it:

ssh root@<ESXi_host_IP>
vim-cmd vmsvc/getallvms
vim-cmd vmsvc/reload <VM_ID>

vim-cmd vmsvc/getallvms lists every registered VM with its numeric Vmid in the first column; use that number as <VM_ID>. The reload is non-destructive — it simply forces the host to re-read the .vmx from the datastore — so it's always safe to try first once the host and datastore are reachable.

Option 2: Remove and Re-Register VM

  • In vSphere Web Client, right-click the invalid VM and select "Remove from Inventory"
  • Browse to the datastore and locate the VM folder
  • Find the .vmx file and right-click to select "Register VM"
  • Once registered, try powering on the VM

Important: When removing from inventory, do NOT delete the files. Only remove the registration. Choosing "Delete from Disk" here permanently erases the .vmx and .vmdk — the exact opposite of what you want. This same remove-then-re-register procedure is the standard fix for orphaned VMs, where vCenter and the host disagree about the VM.

Option 3: Reconnect a Disconnected Host

If an entire host's VMs are invalid at once, the host — not the VMs — is the problem. In the vSphere Client, right-click the ESXi host, choose Connection → Connect, and confirm the management network and vpxa/hostd agents are healthy. Once the host reconnects, its VMs usually return to normal on their own; reload any stragglers with Option 1.

Fixing Storage and Datastore Issues

If the VM's storage is inaccessible, vCenter cannot read the VMX file. Here's how to resolve storage-related issues:

Check Datastore Availability

esxcli storage filesystem list
esxcli storage filesystem mount -u <UUID>

esxcli storage filesystem list shows each datastore and whether it's currently mounted. If the one holding your VM is unmounted, remount it with its UUID, then reload the VM.

Restart Storage Services

/etc/init.d/lwiod restart
/etc/init.d/nfs restart

Restart the NFS service only if your affected datastore is NFS-backed. After storage is healthy again, return to Option 1 and reload the VM before trying anything more invasive.

Prevention Best Practices

  • Monitor logs regularly: Use vRealize Log Insight or Splunk for log aggregation and early warning alerts
  • Ensure datastore redundancy: Use multipath storage configurations and implement storage redundancy
  • Automate VM backups: Regular backups of VM metadata using Veeam, VDP, or enterprise backup solutions
  • Keep systems updated: Regular updates for vCenter and ESXi with proper testing environments
  • Implement proper VM management: Avoid force power-offs and use Storage vMotion for migrations

Because most invalid and orphaned VMs are downstream of storage or host instability, prevention is really a high-availability and disaster-recovery exercise: redundant paths so a datastore never simply disappears, and tested backups so a corrupt .vmx is a five-minute restore instead of a rebuild.

Pro Tip: If issues persist, contact VMware Support with log files for deeper analysis. Always test solutions in non-production environments first.

Frequently Asked Questions

Find answers to common questions

Five main causes: VM files deleted/moved on datastore (70% of cases), host disconnect/failure, storage path broken, VM removed from inventory then re-added incorrectly, corrupted .vmx file. Most common scenario: someone deleted VM folder via datastore browser without removing from inventory—vCenter can't find files, marks invalid. ESXi host failure: VMs on crashed host show invalid until host reconnects (usually temporary). Storage issues: NFS mount fails, iSCSI path down, datastore unmounted—all VMs on that storage go invalid. Corrupted .vmx: power outage during VM config change corrupts descriptor file. Human error: accidentally removing VM from inventory then browsing datastore and re-adding wrong .vmx file. Check vCenter Tasks for recent activity before VM went invalid—often shows storage disconnect or datastore operation. Quick diagnosis: browse datastore, verify VM folder exists with all files (.vmx, .vmdk, .nvram).

Step 1: Right-click VM, select "Remove from Inventory" (doesn't delete files). Step 2: Browse datastore, locate VM folder, verify .vmx file exists. Step 3: Right-click .vmx, select "Register VM", choose datacenter/cluster/resource pool, click OK. VM should now show valid. If still invalid: Step 4: Check .vmx file for corruption—download, open in text editor, look for incomplete lines or binary garbage. Step 5: Restore .vmx from backup or recreate from .vmx~ (automatic backup file in same folder). If .vmx missing: Step 6: Create new .vmx using VM files present—vmkfstools or New-VM PowerShell with existing .vmdk. Timeframe: simple re-register = 2-5 minutes, .vmx corruption fix = 15-30 minutes, recreate from scratch = 1-2 hours. Prevention: enable vCenter VM snapshots, backup .vmx files regularly, don't manipulate datastore directly (use vCenter).

No—"Remove from Inventory" only deletes vCenter database entry, VM files stay on datastore untouched. This is safe operation for fixing invalid VMs. Confusion: "Remove from Inventory" vs "Delete from Disk"—first keeps files, second deletes everything. When you remove invalid VM: .vmx, .vmdk, .nvram, snapshots all remain on datastore (zero data loss). Re-registering VM: browse datastore, find .vmx, right-click Register VM—restores full VM with all data intact. Caveat: if VM went invalid because files were already deleted, removing from inventory doesn't cause deletion (files already gone). Verify before removing: browse datastore in vCenter, confirm VM folder and files exist. If files present: safe to remove from inventory and re-register. If files missing: removing from inventory just cleans up vCenter (VM already lost). Best practice: always browse datastore first to understand why VM is invalid.

Five preventive measures: 1) Never manipulate datastore directly—always use vCenter/PowerCLI for VM operations (90% of invalid VM issues from direct datastore changes). 2) Monitor storage health—configure vCenter alarms for datastore disconnects, check iSCSI/NFS paths weekly, test storage failover quarterly. 3) Enable HA/DRS—automatic VM recovery if host fails, prevents invalid state from host crashes. 4) Backup .vmx files—script to copy .vmx files weekly to backup location (easy restore if corruption). 5) Avoid manual inventory changes—train team to use vCenter properly, restrict datastore browser permissions. PowerCLI prevention script: Get-VM | Export-VmxConfig -Destination \backup\vmx. Storage monitoring: vCenter Alarms → Datastore → Connection/Latency alerts. Access control: vSphere roles—don't give Datastore.FileManagement permission to non-admins. Recovery testing: quarterly DR drill including invalid VM scenarios. These practices reduce invalid VM incidents by 95%.

Yes, but use cautiously—automation works for simple cases (disconnected storage, host reconnect), risky for corrupted files. Safe automation: script to detect invalid VMs and attempt re-registration. PowerCLI: Get-VM | Where {$.ExtensionData.Runtime.ConnectionState -eq 'invalid'} | ForEach { Remove-VM -VM $ -Confirm:$false; New-VM -VMFilePath $.ExtensionData.Config.Files.VmPathName -Location $.VMHost }. This handles VMs where files exist but registration stale. Limitations: doesn't fix missing files, corrupted .vmx, storage issues. Better approach: detection + notification script—alert admins of invalid VMs for manual review. Example: daily scheduled task runs Get-VM invalid check, sends email with list for investigation. Risk: auto-registration without verification can register wrong .vmx file, cause config mismatches. Recommended: semi-automated—script detects and prepares commands, admin reviews/executes. Production safety: test automation in lab environment first.

Optimize Your Virtual Infrastructure

VMware, Hyper-V, or cloud VMs — our team helps you get the most from your virtualization investment.