To traverse inventory objects that are
nested to a variable depth, define one or more recursive
TraversalSpec
objects. In each
TraversalSpec
object, you specify a property of one
managed object that holds a reference to another managed object. The
TraversalSpec
defines a path that the property collector
can follow between objects.
To define recursive inventory traversal, use the
following steps.
Procedure
-
Use the
SearchIndex managed object
to retrieve the managed object reference for the top-level virtual machine
folder.
This folder is used as the beginning of the
inventory traversal. For more information see
SearchIndex.
-
Create an
ObjectSpec object that
references the top-level virtual machine folder.
-
Create a
SelectionSpec object that
references the
Folder TraversalSpec by
name.
-
Create a named
TraversalSpec for
Folder objects.
The
TraversalSpec.path
property identifies the
Folder.childEntity
property for traversal to any child objects.
-
Add the
SelectionSpec to the
TraversalSpec to create the
recursive filter.
-
Add the
TraversalSpec to the
ObjectSpec.
-
Create a
PropertySpec for the
Folder name.
-
Add the object and property specifications
to the
PropertyFilterSpec.
-
Call the
RetrievePropertiesEx method.