Staff Photos in the GAL in Outlook 2010
Closed     Case # 10043     Affiliated Job:  New Trier Township District 2031
Opened:  Tuesday, October 5, 2010     Closed:  Tuesday, October 5, 2010
Total Hit Count:  22149     Last Hit:  Tuesday, October 8, 2024 1:36:38 AM
Unique Hit Count:  6473     Last Unique Hit:  Tuesday, October 8, 2024 1:36:38 AM
Case Type(s):  Development, Server
Case Notes(s):  All cases are posted for review purposes only. Any implementations should be performed at your own risk.

Request:
In an effort to find opportunities for cost savings for our district - each year our district prints out a full color directory of staff photos and their personal details. Upon receiving mine I wanted to see if Outlook offered the ability to display a user's photo since all the other pertinent details are within Outlook already as part of a sync process in place.

Action(s) Performed:
Total Action(s): 1
Action # Recorded Date Type Hit(s) User Expand Details
10151 10/5/2010 2:32:25 PM Server 3703 contact@danieljchu.com Some sample illustrations of photos within Outlook 2010 are shown below.   Collapse ...
Last Hit: Monday, October 7, 2024 7:23:22 PM

Some sample illustrations of photos within Outlook 2010 are shown below.



Outcome:
During my search I discovered a command offered by Exchange 2010:
-   Import-RecipientDataProperty -Identity "USERNAME" -Picture -FileData ([Byte[]]$(Get-Content -Path "C:\Pictures\USERNAME.jpg" -Encoding Byte -ReadCount 0))


However, our school has not yet made a jump to Exchange 2010; therefore, I wanted an alternative scenario. We already have the "ActiveRoles Management Shell for Active Directory" developed by "Quest Software" and using these PowerShell tools we can populate an Active Directory object property that has existed since Windows 2000: "thumbnailphoto"

A step, which I am not certain if it is required, is to allow this "thumbnailphoto" field to be pushed out to the Global Catalog servers. However, I figured this doesn't hurt; therefore, to accomplish this do the following:
-   Run the command "Regsvr32 schmmgmt.dll", if you have not already registered the "Active Directory Schema" snap-in.
-   Execute MMC and add the "Active Directory Scema" snap-in
-   Browse the "Attributes" node and open the properties of "thumbnailphoto"
-   Check the "Replicate this attribute to the Global Catalog" option and select "Apply" - "OK"


Next, if you do have Exchange 2010 (which I have not tried) script out the command made mention to above, research out it's parameters for further details on it's settings. For me, I used the Quest Software "ActiveRoles Management for Active Directory" powershell tools. The process is to first convert the photos to a format suitable for import into A.D. Followed by loading the photo into a variable and uploading it to the appropriate user account. For testing here is a simple command to convert a folder of photos followed by importing a single photo into A.D.
-   The following uses a version of the instructions located at: http://technodrone.blogspot.com/2010/07/updating-pictures-for-users-in-ad-pt-2.html
-   Download "ImageMagick" from: http://www.imagemagick.org/download/binaries/
  o   I downloaded ImageMagick-6.6.4-Q16-windows.zip from this path and extracted the contents
-   Next, using the path you extracted the above, we create a function to use in Powershell which will convert a path of photos to a format appropriate for A.D.
    --Start Code--
    Function convert-pics {
      $cmd = "C:\Temp\ImageMagick-6.6.4\convert.exe"
      Get-ChildItem "C:\Temp\Staff01" | ForEach-Object {
      $newname = "C:\Temp\Staff02\"+$_.Name
      $filename = $_.Fullname
      invoke-expression "$cmd $Filename -resize 96x96 $newname"
      }
    }
    
    convert-pics
    ^--End Code--^
-   After this is completed you can test out a single image by using the following (through the Quest Powershell tools):
    --Start Code--
    $photo = [byte[]](Get-Content "C:\Temp\Staff02\chud.jpg" -Encoding byte)
    Set-QADObject -identity chud -ObjectAttributes @{thumbnailPhoto=$photo}
    ^--End Code--^
-   I would then replicate the domain and review Outlook's global address list to see the photo of the user imported. It seems to be accessible pretty much immediately in Outlook following a replication of the domain.
-   Really, from this point all you would then need to do is script out a mass push of the remaining photos
    --Start Code--
    Get-QADUser -sizelimit 0 -IncludedProperties thumbnailphoto | ForEach-Object {
      if ($_.thumbnailPhoto -notlike "FF*") {
      $filename = "C:\Temp\staff02\"+$_.SamAccountName+".jpg"
      if (Test-Path $filename) {
        $photo = [byte[]](Get-Content $filename -Encoding byte)
        Set-QADObject -identity $_.SamAccountName -ObjectAttributes @{thumbnailPhoto=$photo}
        }
      }
    }
    ^--End Code--^


The results are photos visible throughout Outlook, some examples are in the above action item.



Profile IMG: Footer Left Profile IMG: Footer Right