lithnet / resourcemanagement-powershell

Lithnet FIM/MIM Service PowerShell Module
MIT License
37 stars 12 forks source link

passing objectID in set filter #2

Closed jlclaude closed 8 years ago

jlclaude commented 8 years ago

I am setting up my xml file to create the sets between environments and I have a some sets that reference other sets in the filter. Is there a way to lookup the objectID of a set given the displayname and pass it to the filter in the xml. I do not want to have to lookup the object ID per environment and modify the xml each time I run it. Below is an example of a filter for a set:

/Person[(EmployeeStartDate > '2016-06-30T04:00:00Z') and (EmployeeStartDate < '2016-07-02T04:00:00Z') and (ObjectID != /Set[ObjectID = '9fe32576-6fc6-49f7-bb71-6df7d6ac968b']/ComputedMember)]

so I need to find a way to replace the ObjectID with a variable that is a reference to a set by displayname and passed. Is there a way to do this?

ryannewington commented 8 years ago

Hi, You can do this by building a reference

If you don't have the set referenced in the XML config already, you can create a placeholder for it using a 'none' operation

<ResourceOperation operation="None" resourceType="Set" id="setPasswordResetUsers">
      <AnchorAttributes>
        <AnchorAttribute>DisplayName</AnchorAttribute>
      </AnchorAttributes>
      <AttributeOperations>
        <AttributeOperation operation="none" name="DisplayName>_All People Registered for Password Reset</AttributeOperation>
      </AttributeOperations>
</ResourceOperations>

Once you have an XML reference, then you can use the ##xmlref syntax## in your filter

/Person[(EmployeeStartDate > '2016-06-30T04:00:00Z') and (EmployeeStartDate < '2016-07-02T04:00:00Z') and (ObjectID != /Set[ObjectID = '##xmlref:setPasswordResetUsers:ObjectID##']/ComputedMember)]

The topic on building references has more detail if you need.

Let me know how you go

Ryan

jlclaude commented 8 years ago

works perfectly thanks for the reply Ryan! I am loving the RMConfig module it is making it so easy to setup my lab, qa, and prod to all be kept in sync.

ryannewington commented 8 years ago

Great! Glad its working well for you and thanks for the feedback. :smile: