Hi All
From esx service console, is there a way to find out the location of vmx file for all the VMs ?
I see that vmware-cmd -l does this, but only with respect to the esx server.
I would like to get this info in the VI context.
It looks like vmware-cmd tool cannot connect to the Viretual center server?
Please let me know.
Thanks,
Prasad.
Hi,
Thanks for the response.
But the VMNAME is subject to change. How can I find out the vmx for that ?
Prasad.
What do you mean? That was just an example, change to the name of the VM you are looking for.
Hello,
Try the following SQL command against the VCMS DB:
SELECT e.NAME, vm.DNS_NAME, vm.LOCAL_FILE_NAME
FROM VPX_VM vm LEFT OUTER JOIN
VPX_ENTITY e ON vm.ID = e.ID
It is quick and dirty so you might want to customize it to meet your needs but it gives you the general idea
nice!
Here I've written a little script for you.
Usage: vm_search.sh VMNAME.
VMNAME is the name of the VM you want, and is not case sensitve.
Make sure you make the script executable with "chmod u+x".
IFS='
'
vmname=$1
for location in `find /vmfs/volumes | grep .vmx\$ | grep -i $vmname`
do echo $location
done
Hi,
Probably I was not clear in my question.
I want to find out the vmx location given a VM name.
I get the VM names by running the command
vcbVmName -h -u admin -p pswd -s any
There may not be any vmx file with the given name since Vm name can be changed from the VI client. Changing the VM name will not change the vmx file name.
Thanks,
Prasad.
Does the SQL query not give you that? simply add a line like so:
SELECT e.NAME, vm.DNS_NAME, vm.LOCAL_FILE_NAME
FROM VPX_VM vm LEFT OUTER JOIN
VPX_ENTITY e ON vm.ID = e.ID
Where e.Name = "vm_name"
Hi,
I'm not familiar with sql. Trying to figure out how to connect to VCMS db and execute your query. Appreciate your help.
Thanks,
Prasad
SQL2000 or SQL2005? or something else?
If SQL 2000 open up SQL query analyzer, select your VCMS db, adn then execute the query
Have a look at this script, it finds vmx files by VM display name.
http://www.xtravirt.com/index.php?option=com_content&task=view&id=100&Itemid=67
Or you can do something like:
find . -name \*.vmx -exec egrep -qi 'displayName = " is the name for the VM you are looking for.