Dear All,
Below is the Powershell script that will help you solve broken profile picture issue.
$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()
}
}Please start Full syn or incremental profile crawl
Comments
Post a Comment