Here is a reference link to a blog describing the upload to AD method: http://www.mikepfeiffer.net/2010/06/how-to-use-ad-powershell-to-manage-outlook-2010-user-photos-with-previous-versions-of-exchange/
Importing Photos with AD PowerShell
The following example uses AD PowerShell to import a photo named rhouston.jpg for a user named rhouston:
import-module activedirectory
$photo = [byte[]](Get-Content C:\rhouston.jpg -Encoding byte)
Set-ADUser rhouston -Replace @{thumbnailPhoto=$photo}
Exporting Photos with AD PowerShell
To export a photo that has been set for a user, you can use the following syntax. This would export the photo for a user named rhouston to a file named rhouston.jpg:
$user = Get-ADUser rhouston -Properties thumbnailphoto
$user.thumbnailphoto | Set-Content c:\rhouston.jpg -Encoding byte
You can also bulk upload from Exchange Management Shell using the power shell script below. Please note the following:
· Image must be less than 10 Kb in size.
· It is recommended to use a photo size that is 96x96 pixels.
· When using the script to bulk upload, store all images in the same folder (the script assumes “C:\Photos”). The file names for the photos must be the username. For instance, the filename of a photo being uploaded for username XAhmasi must be XAhmasi.jpg.
· There are 2 files involved in this process. The first is the power shell script named “uploadphotos.ps1”. The second is a file named “users.txt” that contains the list of users by username.
· You run the script by running the PS1 file from Exchange Management Shell in the folder where the script resides as follows:
PS C:\Users\Administrator>.\uploadphotos.ps1
· Copy the contents for the files below into a notepad and save them separately with the respective file names.
First file (power shell script)
----BEGIN CONTENTS OF uploadphotos.ps1 POWER SHELL SCRIPT
Import-CSV users.txt | ForEach-Object {
# NOTE: Users.txt must not end with a blank line.
# $displayName = $_.Last + ", " + $_.First
$UserName = $_.UserName
$DefaultPhotoPath = "C:\Photos\"
$PhotoPath = $DefaultPhotoPath + $UserName + ".jpg"
Get-Mailbox -Identity $UserName
import-RecipientDataProperty -Identity $UserName -Picture -FileData ([Byte[]]$(Get-Content -Path $PhotoPath -Encoding Byte -ReadCount 0))
}
----END CONTENTS OF uploadphotos.ps1 POWER SHELL SCRIPT
Second file (user list)
----BEGIN CONTENTS OF users.txt FILE
UserName
SBrooke
MLinstrom
----END CONTENTS OF users.txt FILE