Missing user profile picture after updating mysite host URL in SharePoint 2013

29. April 2015 02:55 by Rashid Aziz in Sharepoint blogs  //  Tags: , ,   //   Comments

Recently I had to change mysite host URL in one of our environment. After I update my site hots URL and ran full user profile sync. Everything was working fine until I noticed that user images are not appearing inside user profiles.

I have started looking into the issue and done the following steps to figure out the problem

I have checked the user profile “Picture” property to make sure that It is mapped to “PhotoThumbnail” property of active directory

Then I have checked that the Farm account have permissions on User profiles

Using the farm account I have ran the photo import command again 

Update-SPProfilePhotoStore –MySiteHostLocation http://mysiteHostUrl –CreateThumbnailsForImportedPhotos $true

With help of miisclient.exe I have confirmend that the picture property is pull the binary information from active directory. 

I then went to my profile and right click on the “PictureURL” and selected “Properties” option which open up the “Properties” popup window. Suddenly I realised that the URL of my user profile picture is still pointing to the old my site. 


I have copied the above picture URL in the browser, updated the “mysite” host URL to new one and hit enter. I was managed to see my profile picture as below.


At last I managed to find the issue. Now it’s time to fix it. So I wrote below PowerShell command to update all user profile picture properties URL.

$mySiteNewHostURL = "http://NewMySiteHostURL" 
$mySiteOldHostURL = "http://OldMySiteHostURL" 
$mySite = Get-SPSite $mySiteNewHostUrl 
$SPServiceContext = Get-SPServiceContext $mySite 

$userProfileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($SPServiceContext) 
$userProfiles = $userProfileManager.GetEnumerator() 
foreach ($userProfile in $userProfiles) 


  #check if the picture property contain image URL, then replace it with new my site host URL

  if ($userProfile["PictureURL"] -ne '') 

    $oldImageUrl = $userProfile["PictureURL"].toString() 
    $newImageUrl = $oldImageUrl -Replace $mySiteOldHostURL, $mySiteNewHostURL
    write-host "Old Image Link = " $oldImageUrl " --> New Image Link = " $newImageUrl 
    $userProfile["PictureURL"].Value = $newImageUrl 


After I ran above PowerShell script, I was able to see  picture inside my user profile as below. Happy coding Smile

blog comments powered by Disqus

Stay connected

SharePoint Links

Month List