Delen via


Bulk import pictures

A few months ago I posted a procedure on how one can import pictures into Active Directory by using the Exchange Management Shell cmdlet Import-RecipientDataProperty, here:

Upload picture in Outlook 2010 using the Exchange Management Shell (Exchange 2010)

As a follow-up, I would like to show you a way to do this in bulk…(small note: there are other ways, this is just one!)

Setting the scene

I’ve got a bunch of users in my demo environment without a picture yet…

Pic0116

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

Pic0114

Populate AD

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

Import-csv c:\userkes.csv | % { Import-RecipientDataProperty –Identity $_.username –Picture –FileData ([Byte[]]$(Get-Content –Path $_.picture –Encoding Byte –ReadCount 0)) }

Pic0119

Checking the results

Using AdsiEdit….

Pic0117

And using Outlook 2010…

 Pic0118

The power of the Shell :-)

Ilse

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    September 02, 2011
    Take a look at this tool: www.codetwo.com/.../active-directory-photos

  • Anonymous
    July 29, 2015
    The CodeTwo GUI works well, however a limitation is that you cannot import in bulk ONE PICTURE to multiple users without first spending lots of time preparing the JPG filenames.

  • Anonymous
    July 30, 2015
    Did the CSV exactly as baove and even the filenames are the same but get an error- Exch 2010 SP3:
    "Get-Content : Cannot bind argument to parameter 'Path' because it is an empty string."

  • Anonymous
    October 13, 2015
    Today, I came across a question - How to update photos in bulk in Office 365 In Cloud users
    When first

  • Anonymous
    December 03, 2015
    The comment has been removed