How to import photos in Active Directory

AD
There is a minor schema modification required in order to enable the use of photos in AD. The change is to change the thumbnailPhoto attribute to make it replicate to the Global Catalog. If you do not have Exchange 2010 Service Pack 1 (SP1) installed (which automatically makes this Schema change), you do need to follow these steps: 

    • If you haven’t registered the Schema MMC snap-in on the server you want to make this change on, go ahead and do so using the following command: Regsvr32 schmmgmt.dll
    • Open an MMC console (Start/Run/MMC) and add the Schema snap-in.
    • In the Active Directory Schema snap-in, expand the Attributes node, and then locate the thumbnailPhoto attribute.
    • In the Properties page, select Replicate this attribute to the Global Catalog, and click OK.

Then you are ready to import photos into AD. This is done with a Powershell command, for example:

Import-RecipientDataProperty -Identity "Aurel Proorocu" -Picture -FileData ([Byte[]]$(Get-Content -Path "C:\pictures\AurelProorocu.jpg" -Encoding Byte -ReadCount 0))

The recommended thumbnail photo size is 96×96 pixels, and by default, the maximum size of photo that can be imported with the Import-RecipientDataProperty command is 10-KB. There are also options to force inclusion of the photo in the offline address book, see the ‘links for more information’ below on how to make those and other advanced changes related to AD photos.