Reloading a vmx file without removing the virtual machine from inventory

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

Symptoms:
  • Changes are not recognized in vCenter Server when you edit a virtual machine's .vmx file.
  • If you use the Remove from Inventory option to remove the virtual machine, you must re-add it manually with the datastore browser which generates a new Inventory ID.

Environment

VMware vSphere ESXi 8.x
VMware vSphere ESXi 7.x
VMware vSphere ESXi 6.x


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 .vmx file require the Virtual Machine to be Powered off.

To reload the virtual machine's .vmx configuration file, perform one of these options:
  • Reload the .vmx configuration file from the command line:
  1. Log in via SSH or DCUI to the ESXi host as root.
     
  2. Obtain the Inventory ID (Vmid) for the virtual machine using this command:
    # vim-cmd vmsvc/getallvms
    Note: The output shows virtual machines which are registered on the ESXi host.

    You see output similar to:
    Vmid   Name           File                                   Guest OS                Version             Annotation
    10     ExampleVM      [datastore] ExampleVM/ExampleVM.vmx    windows8Server64Guest   vmx-08
    In this example, the Vmid is 10.
     
  3. Reload the .vmx file using this command:

    # vim-cmd vmsvc/reload Vmid
  • Reload the configuration file of all the virtual machines on the ESXi host using a script by running this command in an SSH session:
    # 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