Using Active Directory Thumbnails in SharePoint 2013

Add-PSSnapin Microsoft.SharePoint.PowerShell
$mySitesUrl = “https://mysite.sharepoint.com”
$mySites = Get-SPSite –Identity $mySitesUrl
Update-SPProfilePhotoStore –MySiteHostLocation $mySites –CreateThumbnailsForImportedPhotos $true

One issue I ran into recently had to do with changing the MySite URL. I installed to port 8443 initially to get around the issue of homing multiple SSL sites to the same IP address. After updating the Default Zone URL, all the profile pictures broke (The URL was still referring to the old port number). After spending several hours researching how to resolve this issue, I came up empty handed. I tried running the command above and it didn’t do anything to update the URLs. Stopping short of running a query to manually update the Profile database, I re-examined the PowerShell cmdlet above. Since I didn’t want to “create new thumbnails”, I tried removing that switch and sure enough, all the URLs in the profile database updated properly with the new URL.

One thing to keep in mind with this command is that it should be run as the Farm administrator since the User Profile Service Application runs with those credentials.

You should also setup a task in to run periodically. Since the default time for a User Profile Incremental Sync is 1:00 AM, I set up my scheduled task to fire at 2:00 AM. Your scheduled task can look like this:

Run As: DOMAIN\FarmAccount
Command: c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments: -NonInteractive -NoProfile -File

Excellent Reference for AD Photos and their tie-in with Outlook, Lync and SharePoint:

Advertisements