Configure and display pictures for Exchange 2013 and Lync 2013

Hello,

This is the short script that I created to upload pictures into Exchange 2013.

I places all my files to E:\Photos folder.  After that I created file called Photo.ps1.

Open the file and paste the following:

param([String]$UserName)
Remove-UserPhoto $UserName -Confirm:$False
$DefaultPhotoPath = “E:\Photos\”
$PhotoPath = $DefaultPhotoPath + $UserName + “.jpg”
$photo = ([Byte[]] $(Get-Content -Path $PhotoPath -Encoding Byte -ReadCount 0))
Set-UserPhoto -Identity $UserName -PictureData $photo -Confirm:$False
Set-UserPhoto -Identity $UserName -Save -Confirm:$False

When  you want to upload picture to the Exchange, copy the picture to folder E:\Photos. The picture should have the same name as AD account is.  For example, if you want to add picture to account johnd, the picture should be called johnd.jpg.

Open PowerShell and browse to the directory where you placed Photo.ps1 file and run the following command (for the user johnd):

.\Photo.ps1 johnd

Congratulations. The picture is uploaded.

You can check it using IE or any other browser: https://mail.domain.local/ews/Exchange.asmx/s/GetUserPhoto?email=johnd@domain.com&size=HR648x648

Advertisements

2 thoughts on “Configure and display pictures for Exchange 2013 and Lync 2013

    • I use this script every time I have to add picture.

      I think that when you copy the script from my blog, it modified double quotes. Just manually replace double quotes and it should work.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s