Wednesday, November 20, 2013

Add a User Profile Picture in Active Directory

Good day.
Sometime you need to add a picture for your users accounts in active directory, like this
by the way, this is not me :) 

Today I will talk about how to do this step by step.
First, What you need to have this:

  1. First to have full control on AD users account, I will tell you which value we will modify later.
  2. You will need to download a DLL file ADExt.dll download Here (Mirror Here).
  3. To be an administrator on the server
So let start.
After you download the DLL you will need to install it using the InstallUtil.exe which located :

For 32 bit OS: 
For 64 Bit OS:
I had the ADExt.dll placed on the root of my C Drive so I write
InstallUtil.exe c:\AdExt.dll
The output will be like this picture
Make sure that the result are success, if you get an Access Denied, simply run right click on CMD and select Run as Administrator

We are finished, was it hard :)
Open your active directory and you will find new tab named "Photo", there you can add/update/remove the user picture.
The recommended picture setting should be 10K or less with size 96x96, but using this dll you can add what you want, the dll will manage the size and the view.
But just remember that bigger picture = slower respone
Also think of having hundred of pictures for hundred of employees, these picture (data) will also be replicated.
When adding a picture you are actually adding the value to the following attribs: jpegPhoto for the picture and thumbnailPhoto, this is the default location for users picture and what the DLL do is simply read and render this picture, as the picture is stored in hex value.
you can change the value format to binary/octal/decimal 

You can also use Powershell to update the picture value
Set-ADUser Mary-Replace @{jpegPhoto=([byte[]](Get-Content "C:\pic.jpg" -Encoding byte))}

You can uninstall the DLL using the following command
InstallUtil.exe /u c:\AdExt.dll

I hope you like this post.


Anonymous said...

Hi, after reading this remarkable piece of writing i am too cheerful to share my experience here
with friends.

Anonymous said...

This is my first time pay a quick visit at here and i am truly pleassant
to read all at single place.