Before we start…
1. It’s not supported to create a User Profile Sync connection by script or code using the server object model. We will NOT do this here!
2. The script in this article is part of my “dev lab” setup scripts. – The script cannot be used “as-is” in real world scenarios. If you want to use this approach in your deployment you MUST customize the script to fit your needs! – Especially for selecting sync entries from the Active Directory treeview selector.
3. The script is a Proof of Concept.
4. It’s tested only on SharePoint Server 2010. I’ll do it for SP 2013 later.
5. The script has almost no error handling !!! Sometimes I get the error message “MOSS MA not found”. In this case I restart the “FIMService” and try again.
… is to use Internet Explorer as COM object to navigate to pages of the Central Administration and “act like a user”. This means:
1. Open IE window
2. Navigate to Central Administration -> Manage Service Applications
3. Search of the (first) “User Profile Service Application” in the Service Apps list and navigate to it’s settings page.
4. Open page “Configure Synchronization Connections”.
5. “Click” on link “Create New Connection”
6. Fill in connection parameters such as name, forrest, user profile sync account. Click button “Populate Containers”. Click “Select All”. Click “OK”. Wait until connection is created.
7. On the User Profile Service Application property page: Click on “Start Profile Synchronization”. There select “Start Full Synchronization”. Wait until sync starts. Wait until sync is complete.
Here it is:
(Update) Here is the script for for SharePoint 2013: http://gallery.technet.microsoft.com/Create-User-Profile-Sync-e9ec0cf7 (Article here).
First the script contains some config settings for the new connection.
Here are the input boxes related to the config values (line numbers):
The script is written in for a English localized CA. However I have created resource variables for other languages.
Usage of resource variables (line numbers)
Very nice. I’ve seen only one other person use IE this way in scripts, but I never tried it myself. Definitely going to give this a shot with 2013 as well. Thanks for the post!
wie geil ist das denn. ;-)) Solche Ideen kommen immer nur von Dir.
danke, axel 😉
Is it at all possible to not do a “Select All” and instead choose specific OUs within the container box?