I need to know the full "path" to a VM or Host as it appears in the "Virtual Machines and Templates" view in the vSphere client. Right now, my C# code uses recursion to walk through and build each path individually. For a large environment (500+ VMs) this process takes an extremely long time. I realize the recursion is the problem but am curious if anyone has figured out a more efficient way to collecting a VM or Host's path? Thanks and I've provided a sample below to show what I want to retrieve.
"Atlanta/Development/Mike/MyVM01"
"Atlanta" is the datacenter
"Development" is a folder under the "Atlanta"datacenter.
"Mike" is a folder underneath the "Development" folder.
"MyVM01" is the actual virtual machine display name.
Take a look at this script: you can easily modify the script to change the way it's outputted to what you like.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Take a look at this script: you can easily modify the script to change the way it's outputted to what you like.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
I figured we could not get away from using recursion so I guess I'm just stuck with that. Thanks for the help.