Bulk import pictures in Office 365 users

A few days ago I got a customer request about User photos.
The company had just migrated from Exchange 2010 to Office 365 and was planing to demote the old onpremise Exchange server.
The company policy says, that every user has to have a users photo in own profile. But there where around 20% of the users who didn’t have one.

So firstly i had to find out on which users we have to take the focus.
To find out if a user has a profile photo we simply can use Powershell.
In my case all users where migrated to the O365 cloud, so the first step I had to do was to connect to the customers O365 Tenant by Powershell.
If you need to know the cmdlet to connect to your O365 Tenant by Powershell just have a look here.
After connecting to the Tenant I had to find out first, who has a photo and who not. My focus was primary to know who has not. To find that out I simply had to run the following command:


As you can see in the picture I got is a List with all information I needed.
But to know about how many Profiles we are talking about I need a summary… The command I need for that is almost the same like the previous one, I just need to make a count of it, than the command looks like this:


In my case I see that there are 411 Mailboxes without User photo, by knowing the company it is clear for me, that we are not talking anymore about 20% of the users, we talk about 60%.
That also means only 40% of the users have a photo and from those 15 – 20% have an old one.

After showing this information to the HR, they decided to make a photoshoot for all employees and I will upload/update all photos of the company.

This you can do user by user in the following way:

If you have to do it for multiple users I highly recommend you this way:

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

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


(If you need to know more about the Set-UserPhoto cmdlet you can visit the Microsoft Technet article here.)

If you are running into a error with the Message: “The remote server returned an error: (413) Request Entity Too Large”. I can provide you a following Fix:
In the script that you use to create an Exchange Online Powershell session, make sure that the yellow highlighted section below is added. The normal proxy method won’t work for >10kb files.

Run the first script again, and it now works great with larger photos!

Do keep in mind that the photos you upload should be 648 pixels by 648 pixels if you want the maximum photo size for Office 365.

Now you can Login the Office 365 Portal and check if all worked as expected.

or to show it more close:

 

 

 

Photo by Talles Alves on Unsplash


Leave a Reply

Your email address will not be published. Required fields are marked *