Adding images to AD users using a UploadPhoto.ps1 script

Hi Folks,

After a long period of holidays it’s time to go back to work/blog/twitter and so forth :).

Let’s start talking how to add images to Active Directory users’ attributes and then using Outlook 2010 we will be able to check these images. Ilse Van Criekinge’s webblog has already covered this process (http://blogs.technet.com/ilvancri/archive/2009/11/17/upload-picture-in-outlook-2010-using-the-exchange-management-shell-exchange-2010.aspx) and based on that information I created a simple script to help administrator to upload pictures.

The script is really simple. It is called UploadPhoto.ps1 and it can be found here: http://msmvps.com/blogs/andersonpatricio/pages/script-uploadphoto-ps1.aspx.

To upload a picture to a single user just run UploadPhoto.ps1 <username> and the script will look for a file called <username>.jpg on the default folder (by default is C:\Photos) and it will check and then upload the information.

The script can be also used to upload more than a single user at the same time. You can use the switch -all and all files of the default folder will be uploaded to its respective user. Make sure that the file name and mailbox name are the same. Example: user Anderson and file must be anderson.jpg.

This feature is nice if you have all users photos on the same folder, just run once and it will upload all photos in a single shot.

More information about this script:

  • The script uses the folder C:\Photos as default repository of the JPG files, you can change to reflect your environment just changing the variable $DefaultPhotoPath.
  • Feel free to change and if you add any new improvement, please let me know and I will update the script with your changes.

Cheers,

Anderson Patricio

http://msmvps.org/Blog/AndersonPatricio

http://www.andersonpatricio.org

Twitter: @apatricio


Technorati : , , ,
Del.icio.us : , , ,
Zooomr : , , ,
Flickr : , , ,

7 thoughts on “Adding images to AD users using a UploadPhoto.ps1 script

  1. Thats exactly what i was looking for thanks! However what is the impact on AD of uploading lots of pics? Would lots of pics “bloat” AD in anyway? Ilse Van Criekinge’s blog says to have the jpg less than 10kb. Is that the max limit AD will hold per image?

    Is there a way of uploading all pics into sharepoint and then linking the thumbnail attribute in AD to a sharepoint link?

    Thanks

    Matt

  2. Hi Matt,

    How are you? I hope all is well.

    So.. answering your questions..

    #1 10kb is the limit
    #2 the attribute that receives the file, actually uploads the picture data in a binary way which means that you cannot reference a different place 🙁
    #3 You will increase 10kb each user that you will upload a picture. If you are talking about thousands of users it will “bloat” but the limit is 10kb for a reason. I will try to find official information about this and I will let you know.

    Cheers,
    Anderson

  3. Dear sir;

    thank you from the script , can you tell me how to change the image name from the script to be as Zip/Postal Code under the address filed , becouse we saved our employe ID there and there image`s as there ID in the image folder

    Regards

  4. Thanks for sharing this info. Any thoughts on how I can upload pics in to AD that are saved in SharePoint list/library ?

  5. How can we modify the script so it will look for only new pictures added or modified and then upload them in AD rather then running for all pic all the time .
    SO the first it will run for all pics and then for delta. any ideas ?

Leave a Reply

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