Automating MIM User Profile Synchronization with SharePoint 2016

Microsoft Identity Manager Series

Part 1: Automating MIM User Profile Synchronization with SharePoint 2016

Part 2: Using MIM to Import Custom Attributes into SharePoint 2016

Part 3: Using MIM to Export Custom Attributes from SharePoint 2016

Part 4: Default MIM to SharePoint 2016 Attribute Mappings

Part 5: Basic MIM Configuration to Support SharePoint 2016

Part 6: Scoping the Active Directory Management Agent in MIM

In order to do the fancy stuff we used to do with the User Profile Synchronization Service, such as import User Profile Photos from the thumbnailPhoto attribute or export attributes from SharePoint to Active Directory, SharePoint 2016 requires Microsoft Identity Manager. It’s a fairly simple setup, and the scripts to create the Management Agents are available from the Office PnP solutions. What is missing is automating MIM User Profile Synchronization with SharePoint 2016.

To have a continual synchronization, you’ll need to set up a couple of Scheduled Tasks on the MIM server. We have two scripts, one for a Full Synchronization and one for a Delta Synchronization.

The first one is the Full Synchronization script named MIMSharePointSyncTask.ps1 and located at C:\SharePointSync\.

The second is a Delta Synchronization script named MIMSharePointSyncDelta.ps1 and located in the same directory, C:\SharePointSync\.

Next, we have two Scheduled Tasks, again one for a full synchronization and one for a delta synchronization. These two Tasks have been exported to XML and can be imported through the Task Scheduler graphic interface. Replace “DOMAIN\USERNAME” located in two places, in the <Author> and <UserId> elements, with a valid domain\username value. If the MIM files (that is, SharePointSync.psm1) are not located at C:\SharePointSync, you will need to manually fix that up as well. The full synchronization runs on Sunday, while the delta synchronization runs every 30 minutes.

Note that you can simply import the XML file and then make the changes through the graphical interface, if that is more comfortable for you.

Full Synchronization Scheduled Task:

And here is the MIM Delta Synchronization Scheduled Task:

Once the Tasks have successfully run, do not forget to run another task on a SharePoint server to update the user profile photos. You will need to store the password for this account for the Task, and this account will need to be able to write to the MySite Host as well as have Full Control over the User Profile Service Application. The script is integrated into the arguments for this Task, and this Task runs at 11 PM every day. Adjust as you see fit. Do not forget to update the <Arguments> element, specifically the value of the -MySiteHostLocation, otherwise this will not work.

Once those scripts have been set up, the MIM synchronization and generation of User Profile Photos is complete!


  1. Pingback: Installing SharePoint Server 2016 – Part 3 | Jerry Yasir SharePoint Blog

  2. Pingback: Building SharePoint 2016 development environment – Part 13 – Configuring My Sites and User Profiles | SharePoint and other geeky stuff

  3. Pingback: Planning and Administering SharePoint 2016 – Jeromy Kelley

  4. Pingback: Planning and Administering SharePoint 2016 20339-1 – Jeromy Kelley

  5. Hi Trevor, thanks for this great article. if you let, i want to suggest about article. You can specify that; if the mim server is seperated from sp servers, User Profile Photos task must run on the sp server because of the sharepoint ps module.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.