Virtual Kim

@Kim_Bottu … Virtually Gung Ho

Recreate a VMX file from the log file of a VM

Rarely you might come across a situation where you discover that a VM is running without a VMX file. The link to the VMKB document: how do you solve this? 

I have used this and it works really well!

You will have to rebuild the VMX file but how do you do that? The following is a procedure on how to accomplish exactly that.

1. Shutdown the VM but do not remove it from the inventory.

2. create the following script: in the directory of the VM.


Add the following code, type i to insert text


VMXFILENAME=$(sed -n ‘s/^.*Config file: .*\/\(.\+\)$/\1/p’ ${LOGFILE})

echo -e

“#41/usr/bin/vmware” > ${VMXFILENAME}

echo ‘.encoding = “UTF-8″‘ >> ${VMXFILENAME}

sed -n ‘/DICT — CONFIGURATION/,/DICT —/ s/^.*DICT \+\(.\+\) = \(.\+\)$/\1 = “\2″/p’ ${LOGFILE} >> ${VMXFILENAME}

NEWUUID=$(sed -n “s/^.*UUID: Writing uuid.location value: ‘\(.\+\)’.*$/\1/p” ${LOGFILE})

if [ “${NEWUUID}” ]


sed -i “s/uuid.location = .*$/uuid.location = \”${NEWUUID}\”/” ${VMXFILENAME}


To exit the text editor click ESC and type :wq!


Enable the script for execution

chmod +x



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


This entry was posted on August 11, 2015 by in VM, VMX and tagged , .
Follow Virtual Kim on

Blog Stats

  • 27,573 hits
%d bloggers like this: