Recreating corrupted VMX file

During Vm’s VMX corruption, it loses its ability to power on VM since the VM will either go as “Invalid” or “Inaccessible” state.

There are multiple methods to re-create VMXs files to get the VM up, this is a simple method to recreate VMX with minimal amount of time.

This method(Script) will read the VMware.log of the VMS and based on the logs it will fill up the properties of the VM in VMX file,

How to use this script :

1. Take SSH to the ESX host.

2. Go to the VM Directory.

3. Take backup on existing VMX file #mv vmname.vmx vmname.vmxbackup.

4.Type vi



5. Press I for Insert mode.

6. Paste the script contents.


VMXFILENAME=$(sed -n 's/^.*Config file: .*/(.+)$/1/p' vmware.log)
echo -e "#41/usr/bin/vmware" > ${VMXFILENAME}
echo '.encoding = "UTF-8"' >> ${VMXFILENAME}
sed -n '/DICT --- CONFIGURATION/,/DICT ---/ s/^.*DICT +(.+) = (.+)$/1 = "2"/p' vmware.log >> ${VMXFILENAME}

7. Make the file executable #chmod +x

8. Execute the file #./

9. You can see the VMX is recreated in the VM directory.

10. Re-Register the VM, #vim-cmd solo/registervm /vmfs/volumes/datastorename/newvmx.vmx

Reference KB :


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s