Skip to content

Instantly share code, notes, and snippets.

@danblank000
Created August 20, 2017 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danblank000/41da215cb6fb590eb02dd3cb0d0dad99 to your computer and use it in GitHub Desktop.
Save danblank000/41da215cb6fb590eb02dd3cb0d0dad99 to your computer and use it in GitHub Desktop.
Adding Multiple or Individual Photos to the GAL
<#
######
IMPORT PHOTOS EN-MASSE BASED ON THE PHOTOS BEING NAMED AFTER THE RELEVANT USERS
e.g. for staff members Alan Alanson, Barry Barryson, Charles Charleson,
the photos would need to be name "Alan Alanson.jpg", "Barry Barryson.jpg", "Charles Charleson.jpg".
#####
#>
$PhotoPath = "\\SERVER\SHARE\photos\Outlook\*.*"
ForEach ($PhotoFile in gci $PhotoPath)
{
$User = '' + $PhotoFile.Name.substring(0, $PhotoFile.Name.Length - 4) + ''
<#
#####
YOU CAN USE THE BELOW LINE TO DELETE ALL USER PHOTOS
Set-Mailbox "$user" -RemovePicture
######
#>
Import-RecipientDataProperty -Identity $User -Picture -FileData ([Byte[]]$(Get-Content -Path $PhotoFile.Fullname -Encoding Byte -ReadCount 0))
}
<#
#####
This is the code to import a single photo for a specific user
#####
#>
Import-RecipientDataProperty -Identity "Alan Alanson" -Picture -FileData ([Byte[]]$(Get-Content -Path "\\SERVER\SHARE\photos\Outlook\Alan Aanson.jpg" -Encoding Byte -ReadCount 0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment