The dreaded ticket: a user’s photo had been updated in Active Directory, but the photo in Exchange has not updated. Interestingly enough, this was in a hybrid Exchange 2013 environment. Users located in Exchange Online could see the new photo, but users still located in Exchange on-premises could not (so it would seem the new picture “synced” out to Exchange Online just fine with the user directory synchronization to Office 365).

If you didn’t know it, the Exchange 2013 Mailbox Server stores the photo of users homed on that server. These pictures are located in C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess\photos\<DomainName>-<GUID>. There are two folders found in here, one for storing pictures sized 96×96 and 648×648.

Note: For the purposes of this blog, the same photo was used for the old/new photo.

At first I tried to just delete the photos here for the user and update the offline address book (Get-OfflineAddressBook | Update-OfflineAddressBook). To my surprise, the old picture returned!

Next, I verified the picture associated to the Active Directory user account was indeed the correct one. You can save the photo from the user’s account stored in the thumbnailPhoto property using the following PowerShell command:

$photoDataAD = (Get-AdUser -Identity Jeff.Brown -Properties *).thumbnailPhoto
[System.IO.File]::WriteAllBytes("C:\Down\JeffBrown-AD.jpg", $photoDataAD)

Upon opening the picture, I see that the picture was indeed the new picture. Let’s do the same for the mailbox inside of Exchange, saving the picture with the following PowerShell code (ran from Exchange Management Shell):

$photoDataExchange = (Get-UserPhoto -Identity Jeff.Brown).PictureData
[System.IO.File]::WriteAllBytes("C:\Down\JeffBrown-AD.jpg", $photoDataExchange)

You can also verify the picture stored in Exchange using your webmail URL:

https://<EWS URL>/ews/Exchange.asmx/s/GetUserPhoto?email=<USER EMAIL>&size=HR96x96

And as expected, it was the old picture. Since I had saved the new picture directly from the AD user account, there are Exchange commands to remove a user’s current photo and update it with a new one:

Remove-UserPhoto -Identity Jeff.Brown

Optional step, verify the PictureData property from Get-UserPhoto is now empty:

Now run Set-UserPhoto specifying the path to the AD photo saved from before:

Set-UserPhoto -Identity Jeff.Brown -PictureData ([System.IO.File])::ReadAllBytes("C:\Down\JeffBrown-AD.jpg")

Upon updating the picture manually, it now appeared correctly for the Exchange on-premises users. I still found it interesting that for people in Exchange Online, the photo was updated. I never found a good explanation why the photo in on-premises Exchange had not updated.