Created
August 20, 2017 09:27
-
-
Save danblank000/41da215cb6fb590eb02dd3cb0d0dad99 to your computer and use it in GitHub Desktop.
Adding Multiple or Individual Photos to the GAL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
###### | |
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