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