Missing user profile picture after updating

mysite host URL in SharePoint 2013

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. 

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 $userProfile.Commit ( )

}

}

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

More Blogs

Contact us

To begin your digital transformation, get in touch.

We’re pleased to address any inquiries you might have and assist you in selecting the service that best suits your requirements.

Your benefits:
Speak To Us