WinDeveloper O365 Mailer FREE for 1 Year

WinDeveloper IMF Tune
WinDeveloper IMF Tune

Adding photos to the Exchange 2010 Global Address List

Kenneth Spiteri

Kenneth Spiteri Photo

Kenneth is an Exchange Administrator who loves to share anything he finds interesting with the rest of the community. He also helps with the administration of the site.

Cast your Vote
Poor Excellent

Seeing the photo of users addressed in an email, allows us to more quickly recognize the persons we are interacting with. Apart for Outlook gaining in user friendliness, this can also help pinpoint emails that were addressed to the wrong recipient.

A much sought after feature by the Exchange user community has been the ability to add photos to the Global Address List; giving users a bit more of an identity. This is especially true for larger organizations that sometimes distribute photos through a network share. However it would be so much cooler if users could immediately see who they are sending e-mails to.

In the past, doing this was only possible through custom code. Exchange 2010 makes it possible - and easier - via a new PowerShell command. The process is rather simple, modify an attribute in AD and then upload photos using the Import-RecipientDataProperty cmdlet. Because the images you upload to AD are so small (typically between 3-5KB), the NTDS database size should not be a concern; imagine a 3KB image for 100 employees - this will increase the AD database size by 300KB which is hardly overkill (even with AD replication in mind).

The rest of this article will explain the process of how to add a photo to the GAL, with a demonstration of what you can expect to see when the process is completed.

Preparing the AD Schema

The first thing we need to do is to make a small change to the AD schema. We will set the thumbnailPhoto attribute to replicate to the Global Catalog. To do this, we need to register the schmmgmt.dll library which gives us access to the Active Directory Schema management console. Follow the instructions below:

  1. Open a command prompt (cmd) and enter:
    regsvr32 schmmgmt.dll

    You should see a "succeeded" message box.

  2. Next, click Start | Run... and run mmc.exe. This will bring up the management console.

  3. Go to File | Add/Remove Snap-in... (or press CTRL+M) and choose the Active Directory Schema snap-in, then click Add and OK.

  4. Expand the Active Directory Schema node and click on the Attributes folder. From the right hand pane, locate the thumbnailPhoto attribute. Right click on it and select Properties.

  5. Check the option that says "Replicate this attribute to the Global Catalog" (as shown below) and click OK.

    Global Catalog Replication

TIP: Using the Active Directory Sites and Services console, you can force replication between DCs. Alternatively, you'll have to wait for the default time to be reached until replication occurs.

Once this is done, we can move on to the next step, i.e. importing photos into the thumbnailPhoto attribute. We do this by using the Import-RecipientDataProperty cmdlet.

Importing a Photo into the Active Directory User Object

Follow the procedure below to import photos for a user.

TIP: The recommended image size is 96x96 pixels.

  1. Open the Exchange Management Shell and enter:
    Import-RecipientDataProperty -Identity "Rachel Peach" -Picture -FileData ([Byte[]]$(Get-Content -Path "C:\photos\RachelPeach.jpg" -Encoding Byte -ReadCount 0))

    ...replacing Rachel Peach with the name of the person you want to import a photo for of course.

  2. If successful, it will automatically go to a new prompt (waiting for a new command) - as shown below:

    Import-RecipientDataProperty

  3. If something goes wrong during the import, or there was an incorrect parameter in the cmdlet, you will get an error - as shown in this example:

    Import Error

    Here, there was a mistake in the full path name to the photo.

Importing Photos for Multiple Users (Bulk Import)

If you wish to import photos for multiple users at one go, you can use the following PowerShell script. All files must be ".jpg" and have the same name as the user stored in Active Directory.

# Change the value of this variable according to where you have the photos stored.
$PhotoPath = "C:\Photos\*.*"
ForEach ($PhotoFile in gci $PhotoPath)
{
$User = '' + $PhotoFile.Name.substring(0, $PhotoFile.Name.Length - 4) + ''
Import-RecipientDataProperty -Identity $User -Picture -FileData ([Byte[]]$(Get-Content -Path $PhotoFile.Fullname -Encoding Byte -ReadCount 0))
}

If you ever wish to remove the photo for a particular user, you could do so by executing the following command at the Exchange Management Shell:
Set-Mailbox "Rachel Peach" -RemovePicture

Exporting a user's photo from Active Directory

While I'm at it, I thought it would be beneficial to show you how to export photos from the Active Directory user object. In case you ever needed to, you can use the Export-RecipientDataProperty, as the instructions below show:

  1. Open the Exchange Management Shell and run the command:
    Export-RecipientDataProperty -Identity "Rachel Peach" -Picture | ForEach {$_.FileData | Add-Content C:\exported\RachelPeach.jpg -Encoding Byte}

    Where "Rachel Peach" would be the name of the user whose photo you want to export.

  2. If successful, you will notice that the Exchange Management Shell moves to a fresh line waiting for new input. If you go to the location you specified for the export, you will see that the image has been exported correctly to the specified folder.

User Comments - Page 1 of 1

Rafał 27 Sep 2018 07:42
and
$attributes.Add("thumbnailphoto, Value")
Rafał 27 Sep 2018 07:41
Hi, should be:
$attributes.Remove("thumbnailphoto, Indicator")

Kamal 2 Aug 2015 22:10
Hi, I will be grateful if you can help me out in enabling this feature from Exchange or AD to End user, so outlook or webmail user can upload their own photos.
Reverse this 3 Oct 2013 10:32
Afternoon all, I did this and it all worked and pictures came through on out look and into users blackberrys and their contacts and everything. Then.... I was asked to reverse it as people don't like their image being everywhere. Now I've deployed the GPo to disable the social connector in Outlook 2010 so no pics are shown there but the images are still on the contacts and on the phones. Does anyone know how I can remove them from the Blackberrys and reverse this out?

Thanks in advance!
Mikey 26 Aug 2013 10:02
anyone know if it is possible to change the thumbnail pic on a distribution group and if so how to do it?
Aeid 23 Jan 2013 08:04
I'll echo the previous question: the ConfiguredAttributes property seems to only be present in Exchange 2010. Is there any way to have thumbnailPhotos added to the OAB (i.e. stored as values, not indicator fields) in Exchange 2007?
Hadi Y. 29 Dec 2012 04:25
Any solution for Exchange 2007?
Fox W. 11 Sep 2012 16:13
Hi Paul Adams, would you be able to provide a link to your application? Or an some way we can reach you directly? Thank you.
Security Nut! 18 Jul 2012 19:30
Is there a way to disable users from right-click "Copy" on the photo in Outlook? These photos must not leave our system. Copy paste is just too easy for a user.
Tomasz 12 Jul 2012 23:34
Hi
I did it in my enviroment Exchange 2010 SP2 (and all CU) but in outlook 2010 i don't see photo in Address Book, Global Address List dialog box, Outlook initial page (clicking on Office button). I see only small photo when i add user to TO field in a new e-mail message.
What is the problem?

Tomasz
Stefan Stadlmayr 25 Jun 2012 07:10
is there any way to display the thumbnail photo also in OWA ? (OutlookWebApp)
Nigel 3 Feb 2012 08:03
I have same problem as Tom and Gareth and I am running E2K10 SP2
ijaved 26 Oct 2011 12:03
I created upload script might come in handy. Check out http://usyse.blogspot.com/2011/10/exchange-2010-gal-picture-upload-script.html
Paul Adams 12 Oct 2011 11:05
I have an application that uploads user pictures into active directory, with a treeview control much like AD Users and computers. Just browse to the user you want to set the picture for, select a picture and hit save. Send email to padams at sourcedirect com for the application. Its free and small (800k zipped). Cheers!
Tom 10 Oct 2011 02:34
Rollup 3v3 resolved this problem...
Tom 29 Aug 2011 05:25
I have the same problem. All settings are OK, but pictures not schowing on Outlook 2010 client.
Gareth 4 Aug 2011 02:38
We have Exchange 2010 SP1, AD schema 2008 R2, photos loaded into AD (confirmed cos we can export them to file), but no photos are showing in Outlook (not cahced), any ideas on where to start troubleshooting?
Anonymous 3 Feb 2011 15:52
Can photos be imported into the Exchange GAL for Email Distribution Groups?
Daniela Martinez 3 Feb 2011 09:26
Hi, I would like to know what happen when you configure yor email account of exchange on a cellphone, iphone, blackberry, the photo will be displayed as in the computer, or what will happen?

thanks
Jerome 10 Jan 2011 14:38
What if somr photos do not import even if they are under 10Mb
Adrian 10 Jan 2011 09:28
Matt, your best bet is to restore the default attributes for your OAB, using the command: Set-OfflineAddressBook "Offline Address Book" -UseDefaultAttributes, don't forget to change the "Offline Address Book" to the name of your OAB.
Paul Adams 7 Jan 2011 17:38
I forgot, you have to update the Offline Address book for all of the pictures to be visible immediately. It will take a while for all of the users to see all of the pictures, but eventually they will all download the offline address book. people forget to mention that. ;)
Paul Adams 7 Jan 2011 17:35
I have a working application I wrote that I am willing to share. No powershell, no cli commands. Enter the username, ldap location, domain controller and select an image and click a button. You need domain admin rights. padams at sourcedirect dot com email me and I can send you the C# cose or a zip with the exe. Cheers!
Jameel 22 Nov 2010 16:01
Can this be done if your Exchange is 2007? I have my photos loaded into AD and my Outlook 2010 clients see everything and it works great. However, these powershell commands seem to be for Exchange 2010. Does Exchange 2007 support this?
$attributes = (Get-OfflineAddressBook "Default Offline Address Book").ConfiguredAttributes
$attributes.Remove("thumbnailphoto,Indicator")
Set-OfflineAddressBook "Default Offline Address Book" -ConfiguredAttributes $attributes
$attributes.Add("thumbnailphoto,Value")
Set-OfflineAddressBook "Default Offline Address Book" -ConfiguredAttributes $attributes
Update-OfflineAddressBook "Default Offline Address Book"
Miguel 3 Nov 2010 08:18
Hello, and thank you, it has been very productive. I have followed all steps to configure it and it worked... but... After I closed outlook and restarted it, the pictures did not appear again. I have tested this on several PCs and got the same result. We are using cached mode for the OAB and I believe that the generation of the OAB is wrong. I am getting the following ID event: 9359 from MSExchangeSA and MAPI ID 8008. I have set the debug level to medium and did not get any more information. Hope you could help me.
Jesse 25 Oct 2010 08:13
I had to install rollup 1 for sp1 to get this working again.
Corbett Enders 19 Oct 2010 19:53
The Powershell commands to batch import photos from a directory where the photo filename equals their Exchange mailbox name "john doe.jpg" use the following two lines in Powershell on your Exchange server:

$list = Get-Mailbox -RecipientTypeDetails "usermailbox" -SortBy "name"

$list | foreach { Import-RecipientDataProperty -Identity $_.Name -Picture -FileData ([Byte[]]$(Get-Content -Path "C:\photos\$($_.Name).jpg" -Encoding Byte -ReadCount 0)) }



Jesse 14 Oct 2010 09:13
I had all this working and installed Exchange 2010 sp1 and now outlook doesn't show thumbnails now
Matt 22 Sep 2010 17:42
You forgot a setp in adding the attribute - You MUST remove the attribute from the list before you can run the last command:

$attributes.Remove("thumbnailphoto,Indicator")

This line is required before the last line in the code section to ADD the attribute.
Matt 22 Sep 2010 17:23
I ran something incorrect and now I am only seeing one value configured when I run GetAttributes. How do I pass multiple values into the Set-OfflineAddressBook -ConfiguredAttributes command?
Richard 8 Jul 2010 04:25
Don't worry it is working now
Richard 8 Jul 2010 02:15
I have followed these instructions to the letter but my cached users are not getting the pictures. Any non-chached users are seeing the images. Please what am I doing wrong?
Copyright © 2005 - 2024 All rights reserved. ExchangeInbox.com is not affiliated with Microsoft Corporation