May 31, 2012

Importing profile pictures from AD to SharePoint 2010

Tried many things, many of them complicated, but in one of the more recent cumulative updates Microsoft has a way to get this to work.  To start, I followed this SharePointAdam blog entry:

The first thing to do is get pictures into active directory.  Our Network admin person used a tool from CodeTwo to upload pictures.

To get them into SharePoint I logged onto the server as the Farm Admin (admin rights are required for PowerShell script later on):

1. Opened up Manage User Properties and setup the Picture Property to import from the thumbnailPhoto attribute.
2. Verified that the correct OUs are selected in the Synchronization Connections and Start a Full Sync.

3. Ran the following command in the SharePoint 2010 Management Shell:
Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation <My Sites host location url>

I found the sitehosts by typing Get-SPSites in the console... just used the one I know is for My Sites.

Note: If "-CreateThumbnailsForImportedPhotos" isn't recognized then you don't have a recent enough Cumulate Update... I don't know when it was added, but I do know it's in the March 2012 CU.  Any other errors are likely permissions related and can be resolved by logging in as the Farm Admin.

4. At this point I'm able to pull up a users profile and see the picture is now displaying.

5. To setup the script as a scheduled task I used as a guide. I created the script in notepad, saved it as a PS1 file, and setup the scheduled task.

Script text:
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation <My Sites host location url>

Schedule Setup: