Determining a virtual machine's associated vmx/.vmtx file
search cancel

Determining a virtual machine's associated vmx/.vmtx file


Article ID: 343191


Updated On:


VMware vCenter Server


  • Adding a virtual machine to the vCenter Server inventory fails.
  • Cannot add a virtual machine to the vCenter Server inventory.
  • You see the error:

    A virtual machine or template having the same name is already registered. Server Error: The specified key, name, or identifier already exists.


VMware vCenter Server 6.0.x
VMware vCenter Server 6.7.x
VMware vCenter Server 7.0.x
VMware vCenter Server 5.5.x
VMware vCenter Server 6.5.x


This issue occurs if the .vmx/.vmtx file you are trying to register already exists within vCenter Server. If you do not see a virtual machine by this name, the virtual machine's display name has likely been changed to something different from the filename. If you have many virtual machines, it can be difficult to determine which virtual machine or template name is using this .vmx/.vmtx file.


To generate a list of virtual machine names, the associated .vmx/.vmtx files, and their locations:
Note: You require access to run a query against the vCenter Server database from within SQL Management Studio, or a similar tool for non-Microsoft databases.
  1. Click the New Query button within SQL Management studio.
  2. In the query editor, run this query:
if it is vPostgres 

log-into vcdb using 
/opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres

Execute the below command, this command is safe and will give only output so no need to take a vcdb backup. 

VCDB=# select vpx_entity.Name as "VM Name",vpx_vm.file_name as "File Name / PATH" from vpx_vm inner join vpx_entity on = order by;
       VM Name       |                                          File Name / PATH
 vm1          | ds:///vmfs/volumes/5ba12e8e-dc89f0a8-f12c-002564fd5bf1/vm1/vm1.vmx
 vm2          | ds:///vmfs/volumes/5ba12e8e-dc89f0a8-f12c-002564fd5bf1/vm2/vm2.vmx

select VPX_ENTITY.NAME as "VM Name", VPX_VM.FILE_NAME as "File Name / Path"
From VPX_VM inner join VPX_Entity
on vpx_vm.ID = vpx_entity.ID
order by

The query returns a list similar to:

Note: This list shows all virtual machines and templates and their associated file. Datastores are denoted by their UUID, not by their friendly name.
 VM NameFile Name / Path

Additional Information

确定虚拟机的关联 vmx/.vmtx 文件