• Call Toll Free: 1-855-909-3300

Staying Safe While Altering a VMX file manually

An administrator does not go under the hood of the vSphere environment to modify the behavior of a virtual machine (VM) in a day-to-day management. Mostly, everything is done with the vSphere Web Client. But there may be a time when some manual intervention is needed to modify a vmx file.

Written below are the steps using which an administrator can modify the VMX file for the VM to make the needful change like modifying a value or adding new parameters that cannot be done easily from either the vSphere desktop or Web clients.

Scenarios for intervention

What happens if the vSphere Web Client, the only client that can modify the VMX file, becomes inaccessible but the VM needs to be modified?

Let’s say the VM port group needs to be moved to another network. One tool that can handle this is PowerShell, but not all administrators are familiar with PowerCLI scripting.

In another scenario, an administrator wants to add an advanced configuration to the VMs that cannot be done from the vSphere Web Client.

The anatomy of a VMX file

The configuration for a VM is stored in a file with the extension of .VMX and is located in the VM’s directory on a data store. It’s a text file with a simple structure. Each line contains a parameter and the value for that parameter. Here is an example of a few lines from a configuration file:

virtualHW.version = “10”
displayName = “Win2008Main”
memSize = “4096”
scsi0.virtualDev = “pvscsi”
scsi0.present = “TRUE”
ethernet0.virtualDev = “vmxnet3”
ethernet0.networkName = “VM Network”

There are two methods for editing the configuration file, but for both methods, the necessary preparation steps are the same.

The location of the VM

To access the VMX file on the data store of your ESXi host, we need to pinpoint where the VM resides.

The information from the image below might not be 100% correct. There can be multiple data stores listed because the configuration can be on a different location than the virtual disk files. Or the VM can be renamed which will change the display name but not the name of the VM folder and files. To be certain of the correct location, go to the VM configuration section and verify the location of the VM Config File field.

Power off the VM

You can shut down the guest operating system or force the VM to power off if it does not contain the VMware Tools.

Unregister the VM from your vCenter Inventory

Do this from the vSphere Web Client or vSphere Client on Windows by right-clicking the VM and selecting the option Remove from Inventory. The VM is then no longer listed but it remains on disk.

Download, upload and modify the VMX file:

This method is the simplest. From the vSphere Web Client or vSphere Client on Windows, access the data store where the VM is located and browse the content. From there, browse to the VM directory and select the VMX file.

After downloading the file to your computer, create a backup of the file before making any changes.

You can modify the VMX file on your computer with an editor such as Wordpad on Windows or another text editor. Note that some editors handle carriage returns and line feeds differently, such as Notepad. An editor that doesn’t interpret these characters properly will list all content on a single line rather than separate ones.

After making the necessary changes to the file, upload the file to the same location. The last step is to register the VM again with vCenter by right-clicking the file and selecting the Register VM option from the menu.

Modify the VXM file directly from the command line:

For this procedure, the administrator needs to be familiar with working in a command line interface (CLI).

First, open a command line session to your host either on the local console, enabled from the Direct Console User Interface or through SSH.

Leave a Reply

Techarex NetWorks Products