Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

Tips for editing a .vmx file (1714)

Details

This article provides tips for editing a virtual machine's configuration file (.vmx).

Solution

Working with the .vmx file

Some workaround procedures include steps that require you to edit .vmx files.

Note these important characteristics of the .vmx file:
  • The .vmx file is typically located in the directory where you created the virtual machine.

    • In Windows XP and Server 2003, the default location for the file is:

      C:\Documents and Settings\your_user_name\My Documents\Virtual Machines\virtual_machine_name.vmx

    • In Windows Vista, Windows 7, and Windows Server 2008, the default location for the file is:

      C:\Users\your_user_name\My Documents\Virtual Machines\virtual_machine_name.vmx

    • In Linux, run the vmware-cmd -l command to list the full path to all registered .vmx files.

    • For ESXi/ESX, the vmInventory.xml (located in /etc/vmware/hostd) contains the .vmx file path of every virtual machine registered to it.

  • The virtual machine actively writes to its .vmx file. Never edit this file while its virtual machine is running.
  • Changes to the file are usually version specific. If you upgrade, the workaround you implemented may no longer work.

Before you edit the .vmx file:
  • Always power off the virtual machine.
  • Make sure you are logged on as a user with the correct permission level to edit the file.
  • Make a backup copy of the .vmx file. If your edits break the virtual machine, you can roll back to the original version of the file.
  • For more information on using the vi editor to edit files, see Editing files on an ESX host using vi or nano (1020302).

    Note: VMware also recommends making a backup copy of the edited file. If future administrative changes to the virtual machine overwrite your edited version, you can cut and paste the specific section you want from the backup copy into the current file. Do not replace an entire .vmx file with an older backup.

ESXi/ESX with vCenter Server

Any manual additions to the .vmx file from ESXi/ESX are overwritten by the entries stored in the vCenter Server database.

If you need to edit a virtual machine's .vmx file, first remove it from vCenter Server's inventory (right-click the virtual machine and click Remove from Inventory). After you edit it, register the virtual machine again from the ESXi/ESX command line.

To register the virtual machine from the command line:
  • On ESX 3.x, run the command:

    vmware-cmd -s register /vmfs/volumes/datastore/virtual_machine_directory/virtual_machine_name.vmx

    Where datastore is the datastore name, virtual_machine_directory is the directory containing the virtual machine files, and virtual_machine_name is the name of the virtual machine files.

    For example:

    vmware-cmd -s register /vmfs/volumes/Storage1/vm1/vm1.vmx

    Output of return code =1 indicates success.

  • On ESXi 3.5, ESXi/ESX 4.x, and ESXi 5.0/5.1, run the command:

    vim-cmd solo/registervm /vmfs/volumes/datastore/virtual_machine_directory/virtual_machine_name.vmx

    For example:

    vim-cmd solo/registervm /vmfs/volumes/Storage1/vm1/vm1.vmx

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 92 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (4000 or fewer characters)
  • 92 Ratings
Actions
KB: