Reloading a vmx file without removing the virtual machine from inventory
search cancel

Reloading a vmx file without removing the virtual machine from inventory

book

Article ID: 343248

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

  • Changes are not recognized in vCenter Server when performing an edit of a virtual machine's .vmx file.
  • When using the Remove From Inventory option to remove the virtual machine, re-adding it manually with the datastore browser will generate a new Inventory ID.

Cause

The virtual machine's .vmx configuration file can be reloaded from the command line. This operation does not generate a new Inventory ID (Vmid) for the virtual machine and allows it to stay in the same resource pool.

Resolution

To resolve this issue, reload the virtual machine's .vmx configuration file.

Note: Configuration changes through the .vmx file require the virtual machine to be powered off.

To reload the virtual machine's .vmx configuration file, perform one of these options:
 

Option 1 - reload the .vmx configuration file from the command line

  1. SSH to the ESXi host via root
  2. Obtain the Inventory ID (Vmid) for the virtual machine:

    vim-cmd vmsvc/getallvms

    Note: The output shows virtual machines which are registered on the ESXi host. Command output will be similar to:

    Vmid   Name           File                                   Guest OS                Version             Annotation
    10     ExampleVM      [datastore] ExampleVM/ExampleVM.vmx    windows8Server64Guest   vmx-08

    In the above example, the Vmid is 10.

  3. Reload the .vmx file:

    vim-cmd vmsvc/reload <Vmid>

Option 2 - reload the configuration file of all the virtual machines on the ESXi host using a script

  1. SSH to the ESXi host via root
  2. Reload all virtual machine's configuration files registered to the host:

    for a in $(vim-cmd vmsvc/getallvms 2>&1 |grep invalid |awk '{print $4}'|cut -d \' -f2);do vim-cmd vmsvc/reload $a;done

Additional Information