Working with profile pictures in Active Directory

Add support for photo thumbnails in Active Directory

  1. Download “AdExt.dll”

  2. Place it directly under C:\ Go to %WinDir%\Microsoft.NET\Framework64\ and open the folder for the latest version you have e.g “v2.0.50727”

  3. Open CMD in this folder so that InstallUtil.exe can be accessed and run:

InstallUtil.exe c:\AdExt.dll

Update a single photo with PowerShell

If you just need to change a single photo for a single user you can use this command:

Set-ADUser Mary-Replace @{jpegPhoto=([byte[]](Get-Content "C:\pic.jpg" -Encoding byte))}

Batch change profile pictures in Active Directory

If you need to bulk update the profile picture for multiple users in AD you can use this command. Note that here we have named each picture after the username of each user. So this is not really a sophisticated script, but it does the job if you are handy at Source code editor. Might improve on this later.

$photo1 = [byte[]](Get-Content 'C:\your_folder\username1.jpg' -Encoding byte)
Set-ADUser 'username1' -Replace @{thumbnailPhoto=$photo1}
$photo2 = [byte[]](Get-Content 'C:\your_folder\username2.jpg' -Encoding byte)
Set-ADUser 'username2' -Replace @{thumbnailPhoto=$photo2}
$photo3 = [byte[]](Get-Content 'C:\your_folder\username3.jpg' -Encoding byte)
Set-ADUser 'username3' -Replace @{thumbnailPhoto=$photo3}
$photo4 = [byte[]](Get-Content 'C:\your_folder\username4.jpg' -Encoding byte)
Set-ADUser 'username4' -Replace @{thumbnailPhoto=$photo4}

Sources:

http://farisnt.blogspot.com/2013/11/add-user-profile-picture-in-active.html