Hi All,
Could anyone tell how to get Datacenter managedobjectreference using virtual machine moref? or anyother easy way is there?. If anyone have sample code in C# plz share with me?
Thanks,
Vijaya
You can get the datacenter in which the VM resides in by doing the following lookup:
VM Moref -> Parent (vmFolder)
VM Folder Moref -> Parent (datacenter)
VM's parent object will always be the vmFolder and the vmFolder object will always be a datacenter.
For more details on vSphere Inventory/object model, take a look at this blog post - http://www.doublecloud.org/2010/03/vsphere-inventory-structure-deep-dive/
You can get the datacenter in which the VM resides in by doing the following lookup:
VM Moref -> Parent (vmFolder)
VM Folder Moref -> Parent (datacenter)
VM's parent object will always be the vmFolder and the vmFolder object will always be a datacenter.
For more details on vSphere Inventory/object model, take a look at this blog post - http://www.doublecloud.org/2010/03/vsphere-inventory-structure-deep-dive/
Thanks. Its very helpful to begin my coding.