Wednesday, April 9, 2014

Automating User Profile Photo Import in SharePoint 2013

To automate the User Profile Photo Import process in SharePoint 2013, please use the following sequence.

Prerequisites: User photos must be added to Active Directory and the thumbnailPhoto attribute must be mapped to the Picture property in the User Profile Service Application.

1) User Profile Incremental Synchronization. In the User Profile Service Application, select Configure Synchronization Timer Job. Define a recurring schedule. I scheduled mine to run Daily at 10:00am.

2) Create and schedule a PowerShell script for running Update-SPProfilePhotoStore.

- On one of the application servers in the farm, open Notepad. Copy and paste the following and save it to a desired location as PhotoImport.ps1.

- Open Task Scheduler on the server. Select to Create Task.

General tab:

Triggers tab: (NOTE: Ensure the time is scheduled after the User Profile Incremental Synchronization schedule above, and ensure you schedule enough time for the User Profile Incremental Synchronization task to complete. 30 minutes should be sufficient.)

Actions tab:

Program/script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Add arguments (optional): -psconsolefile "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\CONFIG\POWERSHELL\Registration\psconsole.psc1" -command "D:\Scripts\PhotoImport.ps1" 

- Leave the defaults for the Conditions, Settings, and History tabs. Select OK and type in the logged on user password when prompted.

3)  Incremental Crawl of People Content Source. In the Search Service Application, Edit the Content Source that contains the people address (sps3://mysiteurl). Create an Incremental Crawl schedule as needed. Ensure the time is scheduled after the scheduled task in step 2 above.

Each time the automated 3 step process above is run, it will update the photos in each user’s profile page and in the People search results.

No comments:

Post a Comment