MIM 2016: Dereference an Object via Xpath to a non reference field

We know from the Xpath rules (at least for MIM), that you cannot do this

The following location path expression:

/Person[DisplayName="Kim"]/Manager

is also valid because Manager is a reference attribute type. This location path returns the Person object for Kim’s manager.

However, the following location path expression:

/Group/ComputedMember/DisplayName

is not valid, because DisplayName is not a reference attribute type, and therefore the location path expression cannot return a resource-set corresponding to a collection of FIM resources.

Solution

I will be using Lithnet for this. I want to get the employeeID of all the members of a group. The group ObjectID I will get first, you can also use a known group attribute directly for your dereference.

$mygrp=search-resources -Xpath “/Group[DisplayName=’MyGroup’]”

$GroupObjectID=$mygrp.ObjectID.value

$mygrpEmpID=search-resources -Xpath “”/Person[ObjectID = /Group[ObjectID =’$GroupObjectID’]/ComputedMember]” -AttributesToGet EmployeeID