Lync 2013


In my previous article, I discuss best practices on how to choose high resolution photos to use in user profile pictures for Office 365.

You can upload user profile pictures using the Office 365 Admin Center. It may be obvious to everyone else, but I didn’t know this was possible until a very astute coop student showed me this feature (after I spent an afternoon telling him the only way to do this was to use PowerShell). So, to save you the embarrassment, here is the web-based method:

  1. From the Office 365 Admin Center ( go to Admin then Exchange.
  2. In the Exchange Admin Center click on your profile picture and select Another User…. from the drop-down menu that appears.
  3. The system will pop-up a window listing users in your Office 365 subscription. Search for the user you wish to change and click OK.
  4. The system will pop-up the user’s profile, indicating that you are working on behalf of the user you selected. Scroll all the way to the bottom and select Edit Information…
  5. Another pop-up window (seriously, disable your pop-up blockers if you haven’t done so already) will the editable user profile page, starting with the Photo section. Click on Change
  6. Click on Browse… and select the picture you wish to use.
  7. Click Save to dismiss the window. Close all the pop-ups.

Repeat for all user profiles pictures you wish to upload. If you have Lync open, you should see the results almost immediately.

The profile picture will also be automatically synched with SharePoint user profiles (at least, that has been my experience… please feel free to comment below if you’ve had different results).

While it may be handy to do a few pictures, if you have to update hundreds of user profile pictures, you may want to use the PowerShell method.

In Office 365, you can upload profile pictures for each user’s contact card. The contact card will appear in Outlook, SharePoint, Lync, Word, Excel, PowerPoint… well, in any Office product that displays contact cards 🙂

Sample Contact Card in Outlook 2013
Sample Contact Card in Outlook 2013

While this isn’t a new concept to Office 2013, and this feature is available in On Premise installations, these articles focus on Office 365.

There are two ways to achieve this:

You’ll find all sorts of confusing information online regarding the dimensions, file size and format restrictions. I found that either of the two methods described in this article will work with almost any file sizes and dimensions.

There are, however, some best practices.

Choose Square Photos

Choose a square image as the source (i.e.: same width and height), otherwise the picture will be cropped when you upload and you may end up with portions of people’s faces being cropped out.

Example of a great picture, wrong shape... (Photo Credit: rubenshito)

Will be automatically cropped to:

Auto-cropped result.

Go for the Max

Lync 2010 supported the ability to view contact photos which were stored as part of the thumbnailPhoto attribute in Active Directory, meaning that pictures could only be 48x48 pixels.

However, Lync 2013 can now store photos in user’s Exchange 2013 mailbox, meaning that it supports images of up to 648x648 pixels.

When you upload a photo to Exchange 2013, it automatically creates 3 versions of the photo:

SizeUsed By
48x48Active Directory thumbnailPhoto attribute
96x96Outlook 2013 Web App
Outlook 2013
Lync Web App
Lync 2013
648x648Lync 2013
Lync Web App

If you only upload a smaller image (e.g.: 48x48), it’ll be scaled to 96x96 and 648x648, resulting in photos that look fuzzy. However, if you upload photos that are already 648x648. The system will automatically generate 48x48 and 96x96 thumbnails for you.

imageimage image
imageimage image

(Photo Credit: rubenshito)

Note that if you upload a photo to the thumbnailPhoto in Active Directory, the photo will not be updated in Exchange. If you are lazy like me, you probably want to update photos only once.

My recommendation (and Microsoft's) is to use 648x648 pixels, 24-bit JPG images.

Although you can use the web-based GUI to update profile pictures on Office 365, sometimes you need to upload many pictures at once.

This is where PowerShell comes in handy. Here are the instructions to upload high resolution user profile pictures to Office 365 using PowerShell commands:

    1. Launch the PowerShell console using Run as Administrator
    2. In the PowerShell console, provide your Office 365 credentials by typing the following command and hitting Enter:
      $Creds = Get-Credential
    3. You’ll be prompted to enter your credentials. Go ahead, I’ll wait.
    4. Create a PowerShell remote session to Office 365/Exchange by entering the following command and hitting Enter:
               $RemoteSession = New-PSSession -ConfigurationName Microsoft.Exchange
      -ConnectionUri -Credential $Creds -Authentication Basic
    5. Initialize the remote session by entering:
               Import-PSSession $RemoteSession
    6. Doing so will import all the required Cmdlets to manage Exchange – this is why you don’t need to install any Exchange PowerShell modules or anything like that.
    7. If you get an error at this time telling you something about script execution not being enabled (or something like that, I never read the actual error message). Enter the following command to enable remotely signed commands:
      Set-ExecutionPolicy RemoteSigned

      The above command is only required if you got an error. Some articles may say that you need to set the execution policy to Unrestricted, but – being paranoid – I prefer to limit the policy to remote signed commands. If you got an error while trying to set the execution policy, it is most likely because you forgot to Run as Administrator as indicated in step 1 above. Tsk tsk, pay attention!
      Once you set the execution policy without an error, try step 5 again.

    8. Once the session has been imported, you’ll have new Cmdlets available. The most important one being Set-UserPhoto. But before you need to call Set-UserPhoto, you need to load the photo you want to use. To do so, call:
      $photo = "pathofyourphoto.jpg"

      Making sure to replace pathofyourphoto with the file name for the picture you wish to upload

    9. Now you can set the user’s photo by using the following command:
      Set-UserPhoto -Identity "" -PictureData ([System.IO.File]::ReadAllBytes($photo)) -Confirm:$false

      Making sure to replace with the user id of the profile you wish to change.

    10. Repeat steps 8-9 until all your pictures have been uploaded. One of these days, I’ll write a script to iterate through all the pictures. Let me know in comments below if you need that script.
    11. When done, call
      Remove-PSSession $RemoteSession

For your convenience, here is the whole PowerShell script:

$Creds = Get-Credential
$RemoteSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $Creds -Authentication Basic –AllowRedirection
Import-PSSession $RemoteSession
$photo = “pathofyourphoto.jpg”
Set-UserPhoto -Identity “” -PictureData ([System.IO.File]::ReadAllBytes($photo)) -Confirm:$false
Remove-PSSession $RemoteSession

If you used the PowerShell script above, you’ll be able to upload 648x648 pixel photos without any issues for you and other users. If you didn’t use this script, but you get the following error:

The remote server returned an error: (413) Request Entity Too Large is most likely because you connected to your remote PowerShell session without setting the proxy method.  Compare the two PowerShell commands:

Works Only with Photos 10Kb or Below
$RemoteSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $Creds -Authentication Basic –AllowRedirection
Works with Photos Greater than 10Kb
$RemoteSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $Creds -Authentication Basic –AllowRedirection

I hope the information above helped?

For more information

Set-UserPhoto CmdLet

Configuring the use of high-resolution photos in Microsoft Lync Server 2013