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

  1. 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.

  2. Create an ObjectSpec object that references the top-level virtual machine folder.
  3. Create a SelectionSpec object that references the Folder TraversalSpec by name.
  4. Create a named TraversalSpec for Folder objects.

    The TraversalSpec.path property identifies the Folder.childEntity property for traversal to any child objects.

  5. Add the SelectionSpec to the TraversalSpec to create the recursive filter.
  6. Add the TraversalSpec to the ObjectSpec.
  7. Create a PropertySpec for the Folder name.
  8. Add the object and property specifications to the PropertyFilterSpec.
  9. Call the RetrievePropertiesEx method.