Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create MIM Set
# -- Create Set --
[xml]$SetXML = @'
<Lithnet.ResourceManagement.ConfigSync>
<Operations>
<!-- Create Set -->
<ResourceOperation operation="Add Update" resourceType="Set" id="SetID">
<AnchorAttributes>
<AnchorAttribute>DisplayName</AnchorAttribute>
</AnchorAttributes>
<AttributeOperations>
<AttributeOperation operation="replace" name="DisplayName">__UsersSet</AttributeOperation>
<AttributeOperation operation="replace" name="Description">Set of Users</AttributeOperation>
<AttributeOperation operation="replace" name="Filter" type="filter">/Person[_source = 'PRODAD']</AttributeOperation>
</AttributeOperations>
</ResourceOperation>
</Operations>
</Lithnet.ResourceManagement.ConfigSync>
'@
# Get and update SetXML ID
$id = $SetXML | Select-Xml -Xpath "//ResourceOperation[@id='SetID']"
$id.node.id = $SetIDName
# Get and update the Set DisplayName
$displayname = $SetXML | Select-Xml -Xpath "//AttributeOperation[@name='DisplayName']"
$displayname.node.'#text' = $SyncRuleIDDisplayName +" Set"
# Get and update the Set Description
$description = $SetXML | Select-Xml -Xpath "//AttributeOperation[@name='Description']"
$description.node.'#text' = "Set for "+$SyncRuleIDDisplayName
# Output SetXML File
$SetXML.save($WorkingDirectory[1]+"\NewSet.xml")
# Create the Set
Import-RMConfig -File ($WorkingDirectory[1]+"\NewSet.xml") # -preview -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.