Posts Tagged ‘ User Profiles

SharePoint Health Analyzer: The server farm account should not be used for other services.

The Sharepoint Health Analyzer has “red” reportings, shown in the Central Administration:

The error details for the “The server farm account should not be used for other services.” message are:

{FarmAccount}, the account used for the SharePoint timer service and the central administration site, is highly privileged and should not be used for any other services on any machines in the server farm. The following services were found to use this account: User Profile Synchronization Service (Windows Service).

The Microsoft Technet article at http://technet.microsoft.com/en-us/library/gg750254.aspx says:

This message can be ignored. The User Profile Synchronization Service must run as the farm account.

Well, annonying but obviously not a problem…

How to fix broken images after mySite URL change in SharePoint 2010?

Here is a small PowerShell script to fix the pictureurl for all userprofiles after changing the mySite Url:

$mySiteWebapplicationUrl = "https://mysite.normanbauer.com/"
#current Url of your mySite website

$mySiteOldUrlValue = "http://mysitetest:80/"
#former Url where your pictures do not reside any more

$mySiteNewUrlValue = "https://mysite.normanbauer.com:443/"
#current Url where your images can be found now

$mySite = Get-SPSite $mySiteWebapplicationUrl
$SPServiceContext = Get-SPServiceContext $mySite
$userProfileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($SPServiceContext)
$userProfiles = $userProfileManager.GetEnumerator()

foreach ($userProfile in $userProfiles)
{
  #if pictureurl is not empty replace the old url part with the new one
  if ($userProfile["PictureURL"] -ne '')
  {
    $oldPictureUrl = $userProfile["PictureURL"].toString()
    $newPictureUrl = $oldPictureUrl.Replace($mySiteOldUrlValue, $mySiteNewUrlValue)
    write-host "oldPictureUrl = " $oldPictureUrl " --> newPictureUrl = " $newPictureUrl
    $userProfile["PictureURL"].Value = $newPictureUrl
    $userProfile.Commit()
  }
}