Active Directory Picture Synchronization

When you have stored the pictures of employees in Active Directory you would like to have the option to synchronize these pictures to their SharePoint profile.

This article describes the steps you need to take to import them into the SharePoint profiles.


1. Change the mapping of the Picture profile field.

Navigate to the User Profile Service Application and got to “Manage User Properties”. Find the picture property and select the edit menu item. Add a new Mapping to the “thumbnailPhoto” attribute and select “Ok” when you are done.


AD Mapping


AD Mapping After

2. Perform a Full Import

On the User Profile Service Application select “Start Profile Synchronization” to start a Full Synchronization.

3. Run the command Update-SPProfilePhotoStore

This command let will create the profile pictures in the “User Photo” library in the Mysite host site collection. Run this command with the following options:

Update-SPProfilePhotoStore -MySiteHostLocation [Your Mysite Host Location] -CreateThumbnailsForImportedPhotos 1


4. Check the profiles for their pictures.


One downside to this is that you need to rerun the Update-SPProfilePhotoStore when you have a new Employee for example.


When you would like to try this out on your environment you can use the following PowerShell script for importing a picture in Active Directory.

$username = "tpicture"
$picture = "C:\Pictures\msftplayground.png"

#get the active directory information
$dom = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$root = $dom.GetDirectoryEntry()
$search = [System.DirectoryServices.DirectorySearcher]$root
$search.Filter = "(&(objectclass=user)(objectcategory=person)(samAccountName=$username))"
$result = $search.FindOne()

#if the result not equal to null
if ($result -ne $null){
    $user = $result.GetDirectoryEntry()

    #get the byte array of the picture
    [byte[]]$jpg = Get-Content $picture -encoding byte
    #change the active directory property
    $user.put("thumbnailPhoto",  $jpg )

    Write-Host $user.displayname " updated" -ForegroundColor Green
} else {
    Write-Host $username " Does not exist" -ForegroundColor Red


These steps work for SharePoint 2013 and SharePoint 2010 from CU December 2011.

Related Posts

Forcing a Device Channel Device channels are a way of using different master pages for different devices. MSDN describes the functionality as followed:   “Browsing ...
Offline Installation SharePoint 2013 In many situation you would like to do a offline installation of SharePoint 2013 or you are required to do a offline installation because you do not h...
User automatically removed from SharePoint Group During my current project we received an access request from a user. We did what we normally do, we checked the request and added the user in the appr...
Unable to start User Profile Synchronization Service A few days ago I wrote a post about loading modules in PowerShell by default: “Load modules by default when opening PowerShell”. Today we had to setup...
Filtering SharePoint Search Results by Content Source Working for one my projects we were looking for a solution to only retrieve search results for a specific Content Source. In our scenario we had a Ext...
PowerShell Scripts During my current project we are using a lot of PowerShell scripts to administrate the environment and make development easier for us. In this post...

Leave a Reply

Your email address will not be published. Required fields are marked *

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