Bulk import pictures in Office 365 users


Today, I came across a question – How to update photos in bulk in Office 365 In Cloud users

When first trying to upload a high-res photo for user’s mailboxes, you’ll likely start with the manual for a user Set-UserPhoto and try to write some Powershell script like the below command:

$user = ‘john.doe@contoso.com’

$userphoto = “C:\Temp\”+$user+”.jpg”

Set-UserPhoto -Identity $user -PictureData ([System.IO.File]::ReadAllBytes($userphoto)) -Confirm:$false

Here’s procedure on how one can import pictures in bulk into Office 365 user (In cloud) by using the Exchange Management Shell cmdlet Set-UserPhoto,

To get going, you need a list of mailbox-enabled users, a picture, and a file that links the user to its picture like the comma-delimited file I’m using here…

In my example I will use the same picture for every user

 

Populate Exchange Online

Running the following single line, will populate Office 365 for every user found in that csv file, using the picture listed next to it.

Import-csv c:\Pics\userkes.csv | % { Set-UserPhoto –Identity $_.username -PictureData ([System.IO.File]::ReadAllBytes($_.picture)) -Confirm:$false }

 

Checking the results

Using Portal….

 

Note – If you have Synced users –  Here’s procedure on how one can import pictures into On-prem Active Directory by using the Exchange Management Shell cmdlet Import-RecipientDataProperty

http://blogs.technet.com/b/ilvancri/archive/2010/07/08/bulk-import-pictures.aspx

 

Comments (3)

  1. Singh says:

    Thanks for the nice script, however when I run it fails with a lot red numbers on screen , I mean no sensible error to read from there

    Question: does the admin needs to have full access of the mailbox before running this?

  2. Randy says:

    What is the max file size and resolution?

Skip to main content