Last active
April 26, 2017 00:19
-
-
Save darrenjrobinson/2e9c4a60ccb17a57a9148163db4a533a to your computer and use it in GitHub Desktop.
Create MIM Set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -- 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