OK, I need to get a list of all VM's in all Datacenters in vCenter and the folder they are in....
Here's my query
WITH x AS
(
SELECT DISTINCT name, id
FROM VPX_ENTITY
)
Select x.Name AS ParentFolderName, ve.NAME
From VPX_ENTITY ve
JOIN x ON x.id = ve.Parent_Id
WHERE TYPE_ID = 0 AND PARENT_ID <> 1144 AND x.ID <> 196
ORDER By ParentFolderName, ve.NAME ASC
That gives me a good list of ALL VM's but in their Parent Folder. Parent Folder is really the final folder it is in and doesn't show the folder the "Parent Folder" is in and what folder that is in and ultimately doesn't show what "Datacenter" they are in.
Here whet the folder tree looks like in vcenter...
Datacenter Earth
SQL
SQ2005
SQ2008
Yomama
SQ2012
Oracle
ORA9i
ORA10g
Datacenter Mars
IIS
Websphere
Sharepoint
SP2007
SP2010
Jomama
So, the output I am looking for, for the SQL VM called Yomama should look like this as the sql query output...
"Datacenter Earth" \ SQL \ SQL2008 \ Yomama
The output for the Sharepoint VM called Jomama will look like this....
"Datacenter Mars" \ Sharepoint \ SP2010 \ Jomama
Anyone have any idea on how to get the absolute path of a VM like this?
Thanks