{"id":1717,"date":"2011-10-07T07:07:19","date_gmt":"2011-10-07T07:07:19","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?p=1717"},"modified":"2011-10-07T07:07:19","modified_gmt":"2011-10-07T07:07:19","slug":"more-fun-with-powershell-and-xml-getting-flow-rule-source-attributes-from-a-ma-config-file","status":"publish","type":"post","link":"https:\/\/www.wapshere.com\/missmiis\/more-fun-with-powershell-and-xml-getting-flow-rule-source-attributes-from-a-ma-config-file","title":{"rendered":"More fun with powershell and XML &#8211; getting flow rule source attributes from a MA config file"},"content":{"rendered":"<p>Today I was trying to find a list of all attributes synchronized to Office365 by DirSync. I couldn&#8217;t find a published list so I figured I&#8217;d just get it from the MA, using powershell to extract the list of source attributes. The list of <strong>AD user<\/strong> attributes synchronized\u00c2\u00a0by DirSync is at the bottom of this post, and in between I&#8217;ll show you how I got there.<\/p>\n<p>Note while I&#8217;m talking DirSync here this method will work for MIIS, ILM and FIM Management Agents.<\/p>\n<p><!--more--><\/p>\n<h3>Export the MA<\/h3>\n<p>DirSync is just ILM and you can\u00c2\u00a0get into the Identity Manager client by running:<\/p>\n<p>C:\\Program Files\\Microsoft Online Directory Sync\\SYNCBUS\\UIShell\\miisclient.exe<\/p>\n<p>Note: If you get an error about not having rights then add your account into the MIISAdmins group on the DirSync server then re-login.<\/p>\n<p>Open the &#8220;Management Agents&#8221; page, click on the &#8220;SourceAD&#8221; MA to highlight it, then choose &#8220;Export Management Agent&#8221; from the Actions menu., and save the XML file.<\/p>\n<p><a href=\"https:\/\/www.wapshere.com\/missmiis\/wp-content\/uploads\/2011\/10\/dirsync-parseMA-01.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1718\" title=\"dirsync-parseMA 01\" src=\"https:\/\/www.wapshere.com\/missmiis\/wp-content\/uploads\/2011\/10\/dirsync-parseMA-01.jpg\" alt=\"\" width=\"629\" height=\"292\" srcset=\"https:\/\/www.wapshere.com\/missmiis\/wp-content\/uploads\/2011\/10\/dirsync-parseMA-01.jpg 786w, https:\/\/www.wapshere.com\/missmiis\/wp-content\/uploads\/2011\/10\/dirsync-parseMA-01-300x139.jpg 300w\" sizes=\"auto, (max-width: 629px) 100vw, 629px\" \/><\/a><\/p>\n<h3>Parse the XML file in Powershell<\/h3>\n<p>Now I go into powershell and load the content of the xml file into a variable:<\/p>\n<pre>PS C:\\scripts&gt; [xml]$xml = get-content .\\dirsync-sourceAD.xml<\/pre>\n<p>I can see all the import attribute flows like this:<\/p>\n<pre>PS C:\\scripts&gt; $xml.\"export-ma\".\"mv-data\".\"import-attribute-flow\".\"import-flow-set\"\r\n\r\nmv-object-type                                                                              import-flows\r\n--------------                                                                              ------------\r\ngroup                                                                                       {import-flows, import-flows, import-flows, import-flows...}\r\ncontact                                                                                     {import-flows, import-flows, import-flows, import-flows...}\r\nperson                                                                                      {import-flows, import-flows, import-flows, import-flows...}<\/pre>\n<p>Right now I&#8217;m only interested in the &#8220;person&#8221; attribute flows:<\/p>\n<pre>PS C:\\scripts&gt; $xml.\"export-ma\".\"mv-data\".\"import-attribute-flow\".\"import-flow-set\"[2]\r\n\r\nmv-object-type                                                                              import-flows\r\n--------------                                                                              ------------\r\nperson                                                                                      {import-flows, import-flows, import-flows, import-flows...}<\/pre>\n<p>This next one lists the defined attribute flows. There&#8217;s a lot more but I&#8217;m just showing the top few.<\/p>\n<pre>PS C:\\scripts&gt; $xml.\"export-ma\".\"mv-data\".\"import-attribute-flow\".\"import-flow-set\"[2].\"import-flows\"\r\n\r\nmv-attribute                                                  type                                                         import-flow\r\n------------                                                  ----                                                         -----------\r\nassistant                                                     ranked                                                       {import-flow, import-flow}\r\ncompany                                                       ranked                                                       {import-flow, import-flow}\r\ndepartment                                                    ranked                                                       {import-flow, import-flow}\r\ndisplayName                                                   ranked                                                       {import-flow, import-flow}\r\nfacsimileTelephoneNumber                                      ranked                                                       {import-flow, import-flow}\r\ngivenName                                                     ranked                                                       {import-flow, import-flow}<\/pre>\n<p>It might look as though the mv-attribute is what I want, but actually that&#8217;s an internal sync service attribute, and not the Active Directory attribute. I need to go a little deeper into the xml to get that.<\/p>\n<p>First I&#8217;ll define a new variable to simplify my xml path:<\/p>\n<pre>PS C:\\scripts&gt; $importflows = $xml.\"export-ma\".\"mv-data\".\"import-attribute-flow\".\"import-flow-set\"[2].\"import-flows\"<\/pre>\n<p>Then all I have to do is loop through picking out the &#8220;src-attribute&#8221;. The results are listed below:<\/p>\n<pre>PS C:\\scripts&gt; foreach ($iaf in $importflows) {$iaf.\"import-flow\"[0].\"direct-mapping\".\"src-attribute\"}\r\nassistant\r\ncompany\r\ndepartment\r\ndisplayName\r\nfacsimileTelephoneNumber\r\ngivenName\r\nhomePhone\r\ninitials\r\nmanager\r\nmobile\r\nphysicalDeliveryOfficeName\r\npostalCode\r\ntelephoneNumber\r\ntitle\r\nmailNickname\r\nipPhone\r\nmiddleName\r\notherFacsimileTelephoneNumber\r\notherHomePhone\r\notherIpPhone\r\notherMobile\r\notherPager\r\notherTelephone\r\npager\r\ncountryCode\r\ndescription\r\ninfo\r\nstreetAddress\r\nwWWHomePage\r\nurl\r\nextensionAttribute11\r\nextensionAttribute12\r\nextensionAttribute13\r\nextensionAttribute14\r\nextensionAttribute15\r\nmail\r\ncn\r\nl\r\nco\r\nsn\r\nst\r\npostOfficeBox\r\nmsRTCSIP-UserEnabled\r\nlegacyExchangeDN\r\nmsExchHideFromAddressLists\r\nmsExchMailboxGuid\r\nmsExchAssistantName\r\nmsDS-HABSeniorityIndex\r\nmsDS-PhoneticDisplayName\r\nmsExchArchiveGUID\r\nmsExchBypassModerationFromDLMembersLink\r\nmsExchBypassModerationLink\r\nmsExchEnableModeration\r\nmsExchImmutableId\r\nmsExchModeratedByLink\r\nmsExchModerationFlags\r\nmsExchRecipientDisplayType\r\nmsExchResourceCapacity\r\npreferredLanguage\r\npublicDelegates\r\ntelephoneAssistant\r\nmsExchResourceDisplay\r\nthumbnailPhoto\r\nmsExchBlockedSendersHash\r\nmsExchSafeRecipientsHash\r\nmsExchSafeSendersHash\r\nextensionAttribute1\r\nextensionAttribute10\r\nextensionAttribute2\r\nextensionAttribute3\r\nextensionAttribute4\r\nextensionAttribute5\r\nextensionAttribute6\r\nextensionAttribute7\r\nextensionAttribute8\r\nextensionAttribute9\r\nmsExchResourceMetaData\r\nmsExchResourceSearchProperties\r\nmsRTCSIP-Line\r\nmsRTCSIP-PrimaryUserAddress\r\ntargetAddress\r\nmsExchSenderHintTranslations\r\nmsExchArchiveName\r\nmsRTCSIP-DeploymentLocator\r\nmsExchRemoteRecipientType\r\nmsExchLitigationHoldDate\r\nmsExchLitigationHoldOwner\r\nmsExchRecipientTypeDetails\r\nmsExchRetentionComment\r\nmsExchRetentionURL\r\nmsExchAuditAdmin\r\nmsExchAuditDelegate\r\nmsExchAuditDelegateAdmin\r\nmsExchBypassAudit\r\nmsExchDelegateListLink\r\nmsExchELCExpirySuspensionEnd\r\nmsExchELCExpirySuspensionStart\r\nmsExchELCMailboxFlags\r\nmsExchMailboxAuditEnable\r\nmsExchMailboxAuditLogAgeLimit\r\nmsRTCSIP-OptionFlags\r\nmsExchUsageLocation\r\n\r\n____________________________________________________________________________________________________________________________________________________________________________________<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Today I was trying to find a list of all attributes synchronized to Office365 by DirSync. I couldn&#8217;t find a published list so I figured I&#8217;d just get it from the MA, using powershell to extract the list of source attributes. The list of AD user attributes synchronized\u00c2\u00a0by DirSync is at the bottom of this&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[42,34,28,56,23],"tags":[],"class_list":["post-1717","post","type-post","status-publish","format-standard","hentry","category-fim-2010","category-ilm2007","category-miis2003","category-office-365","category-powershell"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pkp1o-rH","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/1717","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=1717"}],"version-history":[{"count":8,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/1717\/revisions"}],"predecessor-version":[{"id":1726,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/1717\/revisions\/1726"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=1717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/categories?post=1717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/tags?post=1717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}