How to Import Employee Pictures Into Active Directory

In this post we will see how to import employee pictures into Active Directory. There are several ways of importing the pictures into Active Directory, what i mean by importing pictures is that you can add a picture in Active Directory and it will be displayed in Outlook and Lync client.

There are lot of third party softwares that can import the photos, edit the photos and set the photos for user accounts. I wouldn’t recommend to install any third party software for setting up the picture for user account.

In this post we will be using a simple command to set a picture for user account. Remember that the size of the picture must be less than or equal to 10KB.

How to Import Employee Pictures Into Active Directory

We will use an exchange command Import-RecipientDataProperty to set the picture for the user account. Login to the Exchange Server 2010 with an Exchange administrator account and launch the Exchange Management Shell.

Type the command

 Import-RecipientDataProperty -Identity "Username" -Picture -FileData ([Byte[]] $(Get-Content -Path "Provide path to pic" -Encoding Byte -ReadCount 0))

Example –

Import-RecipientDataProperty -Identity "Eric.Dane" -Picture -FileData ([Byte[]] $(Get-Content -Path "C:UsersexadminPicturesTree.jpg" -Encoding Byte -ReadCount 0))

How to Import Employee Pictures Into Active Directory Snap 1

The picture that we had imported for the user account can now be seen in Outlook 2010 client.

How to Import Employee Pictures Into Active Directory Snap 2

You can use the PowerShell command to set the picture for user in Active Directory.

Login to exchange server and click on start and type PowerShell in search programs and files text box.

Click the Active Directory Module for Windows PowerShell.

Note that you can also login to domain controller and perform the same steps.

How to Import Employee Pictures Into Active Directory Snap 3

Syntax of the command –

$photo = [byte[]](Get-Content path of pic -Encoding byte)

Set-ADUser username -Replace @{thumbnailPhoto=$photo}

Example –

$photo = [byte[]](Get-Content C:UsersexadminPicturesTree.jpg -Encoding byte)

Set-ADUser eric.dane -Replace @{thumbnailPhoto=$photo}

How to Import Employee Pictures Into Active Directory Snap 4

3 Comments

  1. Hai,

    Need help about how to config Microsoft AD custom lock on screen for Windows 10 client PC on organisation enviroment?

    Thanks a lot.

  2. Hi

    I’m looking for a solution to add not only one picture to AD but a few. Code below:

    $photo = [byte[]](Get-Content C:UsersexadminPicturesTree.jpg -Encoding byte)

    Set-ADUser eric.dane -Replace @{thumbnailPhoto=$photo}

    works perfect but only for one picture. I need script to add more than one picture.

    I am not a programmer so could you help me ??

Leave a Reply

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