stumpr
Virtuoso
Virtuoso

Mark,

You would probably want to look at RetrieveProperties and traversal specs. The idea would be to get a Managed Object Reference to the starting folder, then do a RetrieveProperties for all Virtual Machines that exist as children of that folder or any sub-folders (or other managed objects).

Since you're using PHP, probably won't find a concrete PHP example but you should be able to convert a C++/Java/C# example from a lot of the forum posts.

                FolderTraversalSelectionSpec.name = new string("FolderTraversalSpec");
		 
		FolderTraversalSpec.name = new string("FolderTraversalSpec");
		FolderTraversalSpec.type = "Folder";
		FolderTraversalSpec.path = "childEntity";
		FolderTraversalSpec.skip = &xsd_true;

		FolderTraversalSpec.selectSet.push_back(&FolderTraversalSelectionSpec);
		
		PropertySpec.type = "VirtualMachine";
		PropertySpec.all = &xsd_false;
		PropertySpec.pathSet.push_back("name");
		
		ObjectSpec.obj = <managed object reference of your folder from FindByInventoryPath>;
		ObjectSpec.skip = &xsd_true;
		
		ObjectSpec.selectSet.push_back(&FolderTraversalSpec);

		PropertyFilterSpec.propSet.push_back(&PropertySpec);
		PropertyFilterSpec.objectSet.push_back(&ObjectSpec);
		

		RetrievePropertiesReq._USCOREthis = ServiceContent->propertyCollector;
		RetrievePropertiesReq.specSet.push_back(&PropertyFilterSpec);

Assuming your starting folder in ObjectSpec.obj was a vmFolder subfolder, should work (I'd have to check my TraversalSpec logic in a bit more detail to be confident).

As usual some work might be needed to get the PHP soap constructed to match the VIM objects from the snippet above. Then you'll make your RetrieveProperties call and get your array of results (objects with properties, in this case just the "name" property).

Reuben Stump | http://www.virtuin.com | @ReubenStump