Import profile pictures from Active Directory to SharePoint.  This is a PowerShell script that will work on SharePoint 2013 or SharePoint 2016 so you can use Active Directory Import and this script to get your pictures sync'd.

This assumes that the profiles are populated.  

There is logging and even a write to disk so you can see the pictures that were imported. Logs and the pictures will be written to $location. Here are the variables that will need to be changed to your environment:


 Blog: https://adamsorenson.com/sharepoint-profile-picture-import-1-3/

 

 

PowerShell
Edit|Remove
$Location = "C:\Dirsync\" 
#First time running, just run "DirSync" then "UploadPicture $adusers" 
#Update RootDSE to match your domain 
$RootDSE = [ADSI]"LDAP://dc=contoso,dc=com" 
$site = Get-SpSite http://MySiteHost 
$domain = "contoso\" 
#This will write the pictures to the folder specified in $location 
$write2disk = $true 
#LDAP filter that is currently set to pull in users with thumbnailphoto and not disabled users. 
$LDAPFilter = "(&(objectCategory=person)(objectclass=user)(thumbnailphoto=*)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))" 
#Set $UseDifferentSvcAccount to true to be prompted for a different service account. False will use the user that is running the script to connect to AD. 
$UseDifferentSvcAccount = $false 
We also need a DNLookup.xml in the $location file. We need the DNLookup just like SharePoint does since DirSync returns DN.
NOTE: We still need to run Update-SPProfilePhotoStore to create the thumbnails