Exchange Server 2010 Global Address List and User Photos

by Arman Obosyan 21. March 2010 19:58

Вы наверно уже не раз встречали статьи на тему фотографий пользователей в глобальной адресной книге, если вы ещё не знакомы с этим, то можете ознакомится на msexchangeteam.com(GAL Photos in Exchange 2010 and Outlook 2010) и тут на русском Фото пользователей в GAL Exchange 2010 и Outlook 2010

Недавно я встретил более простой метод работы с фотографиями, скрипт Anderson Patricio который позволяет легко загрузить фотографии как одному пользователю так и сразу нескольким одновременно!

Скрипт доступен тут и тут UploadPhoto.ps1

Содержимое скрипта выглядит следующим образом,

# Script created by Anderson Patricio (http://msmvps.org/blogs/AndersonPatricio)
#
#
Syntax:
#
uploadphoto.ps1 <mailbox-name>
#
uploadphoto.ps1 -all (It will load all jpg files from the default folder and upload to the users in AD
#

param([Switch]$all, [String]$UserName)

#Default Values. Change them based on your environment.
$DefaultPhotoPath = 'C:\Photos'

Function CheckPhoto(){
Write-Warning "Validating file(s).."
Write-Host "File exists... " -nonewline
If (Test-Path $PhotoPath)
{
Write-Host "[OK]" -ForeGroundColor Green
Write-host "Photo size... " -nonewline
$PhotoSize = Get-ChildItem $PhotoPath | select Length
If ($PhotoSize.Length -le 10000) { Write-Host "[OK]" -ForeGroundColor Green }
Else { Write-Host "[Fail]" -ForeGroundColor Red; exit }
}
Else
{
Write-Host "[Fail]" -ForeGroundColor Red
Exit
}
}
Function UploadAll(){
ForEach ($TempFile in Get-ChildItem $DefaultPhotoPath | Where-Object { $_.Extension -eq ".jpg" } )
{
$TempUserName = $TempFile.Name.substring(0, $TempFile.Name.Length - 4)
Write-Host $TempUserName -ForeGroundColor Yellow -NoNewLine
Import-RecipientDataProperty -Identity $TempUserName -PictureFileData
([Byte[]]$(Get-Content -path $TempFile.Fullname -Encoding Byte -ReadCount 0))
Write-Host "[Done]" -ForeGroundColor Green
}
}

If ( $all -eq $true)
{
Write-Warning " ## This action will upload all pictures of C:\Photos to the AD users."
Write-Warning " ## All pictures must have the same name of the usernames"
Write-Warning "Are you sure that you want upload all pictures to the users (Y/N)?"
$Opt = Read-Host
If ( $Opt -eq 'y' ) { UploadAll; } Else { Write-Host "No changes were made."; Exit }
}
Else
{
$PhotoPath = $DefaultPhotoPaty + $UserName + '.jpg'
CheckPhoto;
If ( $AbortMission -eq '$true' ) { Write-Error "Please, review the errors and try again." }
Else { Import-RecipientDataProperty -Identity $UserName -PictureFileData 
([Byte[]]$(Get-Content -path $PhotoPath -Encoding Byte -ReadCount 0)) } 
}
#--------

(*лучше не копировать, скрипт брать тут или тут UploadPhoto.ps1)

Где $DefaultPhotoPath = 'C:\Photos' путь наших фотографии

Работа скрипта простая

uploadphoto.ps1 “маилбокс” (загрузка фотографий конкретному пользователю)
uploadphoto.ps1 all (загрузка фотографий всем пользователям, названия фотографий должны соответствовать с пользователеми)

Рекомендуемые параметры фотографий 96×96 пиксель и максимальный размер 10Kb

Пример работы, загрузка нескольким пользователям фотографий

Легко и просто!

Результат смотрим в Outlook 2010

 

Несмотря на то что нет встроенных "простых" средств (я про EMC и EMS в стиле Set-Mailbox -Picture) на установку фотографий, но вот на удаление есть готовый командлед Set-Mailbox “маилбокс”–RemovePicture

Вот пока на этом все

About the author

Arman Obosyan is an experienced IT Pro. with over 9 years work experience in Information Technologies sector. Now is working in National Bank of Georgia on a position Head of IT Infrastructure. Last 3 years working with one of the leading Bank in Georgia. His specialization is Messaging, Directory Services and other Microsoft server software solutions; also has good experience in maintenance and configuring Enterprise class storages and Enterprise class hardware/software solutions from various vendors,....

His hobby is Computers and despite very loaded and heavy working schedule he always finds time to participate in testing of Microsoft’s new Beta products.

Certified since 2003 year, have passed following certifications MCP, MCSA, MCSE, MCTS, MCITP

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

RecentComments

Comment RSS