Wednesday, August 29, 2012

Adding Photos to the GAL

Importing a Photo in to AD using Powershell. The Photo will then be shown in Outlook, SharePoint and others that take advantage of this.

The photo data is stored in the thumbnailPhoto Attribute. this attribute is replicated so it is important to keep the image size releivley small 96 X 96 is a good size and runs about 10k depending jpeg quality. If you are Excahnge 2010SP1 the attribute is added during the Schema prep. if you are not on Exchange 2010 SP 1 here is a ELHO Blog on how to add the Attribute to the AD Schema.

http://blogs.technet.com/b/exchange/archive/2010/03/10/gal-photos-in-exchange-2010-and-outlook-2010.aspx

The following PS CmdLet will import the photo.

Import-RecipientDataProperty -Identity -Picture -FileData ([Byte[]]$(Get-Content -path -Encoding Byte -ReadCount 0))