Reloading a vmx File Without Remove That From vCenter Inevntory

I’m working on a solution that it needs to edit something on virtual machine vmx file. But as you know, vmx file should be removed and re-add from vCenter inventory for apply new configurations.

This process is very simple but you have to find your virtual machine datastore and remove the virtual machine from inventory and re-add that again.

There is a way for reloading your vmx file without do the above process from ESX/ESXi command line (Tech Support Mode).

To reload the virtual machine configuration .vmx file on an ESXi/ESX host from the command line:

  1. Log in to the Local Tech Support Mode console of the ESXi/ESX host.
  2. Obtain the Inventory ID (Vmid) for the virtual machine by running the command:# vim-cmd vmsvc/getallvmsThe output shows virtual machines which are registered on the ESXi/ESX host.

    Example output:

    Vmid   Name                          File                Guest OS                 Version     Annotation
    2848   Win2003_storage_performance   [local] Win .vmx    winNetEnterpriseGuest    vmx-07      To be used as a template

    In this example, the Vmid is 2848.

  3. Reload the virtual machine configuration .vmx file by running the command:# vim-cmd vmsvc/reload Vmid

 

To reload configuration files of all the virtual machines on the ESXi/ESX host using a script, run this command:Update:

Below command will not work.

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

Use this:

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

Thanks Sohrab Kasraeian for correction.

Reference: VMware KB1026043

Davoud Teimouri

Davoud Teimouri is as a professional blogger, vExpert 2015/2016/2017/2018/2019, VCA, MCITP. This blog is started with simple posts and now, it has large following readers.

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to our newsletter and join other subscribers

Holler Box