One of the new features in Exchange 2010 is the ability to import thumbnail photos into Active Directory. When you import a photo for a user into Active Directory, the image can be displayed in Outlook email messages and the global address list. You can manage thumbnail photos using the Import-RecipientDataProperty and Export-RecipientDataProperty EMS cmdlets.
While this is a very useful new feature, it is likely that entry level support techs or HR personnel that are not yet PowerShell savvy will be responsible for managing thumbnail photos. So, I've written a PowerShell based application using PrimalForms 2009 that provides a graphical interface to these cmdlets.
How Does It Work?
It's pretty simple. Go through this Exchange Team blog post to get your environment configured. Next, you need to download the script from here and save the code to a file with a .ps1 extension. Of course, the user running the application will need to be assigned the appropriate permissions.
The only other requirement is that you run the script from a machine running PowerShell v2. If you do not have the Exchange tools installed, the script will detect this and import the EMS cmdlets from an Exchange server in the local AD site (I blogged about how to do this a while ago in this post). Take a look at the following screen shot and the steps that explain how to use the application:
![]()
- Select a Mailbox. Type a name (you can use wild cards) and click on Search. Highlight the mailbox you want to configure in the results pane.
- Select a Photo. Click on Browse and navigate to a .jpg file that you want to use for the user. This should be no larger than 10k. Also, keep in mind that the recommended thumbnail photo size in pixels is 96x96 pixels.
- Upload a New Photo. Once you've selected a mailbox and a photo, click on the Upload New Photo button to add the image to Active Directory.
- Preview Current Photo. You can click on the Preview Current Photo link after selecting a mailbox to see the current image in the Photo Preview window. The Photo Preview window will also display photos that you browse to on your machine so you can see them before uploading them.
After you've uploaded a photo for a user, you can view it in Outlook 2010 when browsing the global address list, or in an email message, as shown below:
![]()
In my environment, it takes about 10-15 seconds to import the EMS commands into the local PowerShell session. Because of this, I added a message before the main form loads telling the user to "please wait" while the application is started. If the Exchange tools are installed and/or the commands have already been imported into your PowerShell session then you will not see this message.
What Else?
What functionality you would add to this tool? What other PowerShell based GUI tools would you build (or like to see built) to support your Exchange environment?
Related posts:
- How To: Use AD PowerShell to Manage Outlook 2010 User Photos with Previous Versions of Exchange
- Import EMS Commands from an Exchange 2010 Server in the Local AD Site
- Creating Scheduled Tasks for Exchange 2010 PowerShell Scripts
- Managing Exchange 2010 with Remote PowerShell
- Populating Exchange Labs with Mailboxes using PowerShell



{ 1 trackback }
{ 18 comments… read them below or add one }
First I would like to say thanks for your hard work. I would love to be able to use this tool.
I am hoping you can help me out. When I run the script I get this error:
Cannot bind parameter ‘ConnectionUri’. Cannot convert value “http:///Powershell/” to “System.Uri”. Error: “Invalid URI: The hostname could not be parsed.”
After I select OK, the form does show up but when I try to search on a name I get this error:
The term ‘Get-Mailbox’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
This is from a Windows 7 x64, I also get the same error on a Windows XP x32.
Thanks for any help and of course thanks again for the tool.
Hi Robert,
It looks like it’s not finding your Exchange server. The script searches the current AD site for potential servers to connect to. Are the IP subnets used by the PCs defined in AD?
Try this…
1. Comment out line #97
2. On line #109, replace $fqdn with the FQDN of your Exchange server.
WOW! What response time.
I did what you recommended and I get another error:
Cannont validate argument on parameter ‘Session’. The argument is null. Supply a non-argument and try the command again.
I should have said this on my first post. We are running Exchange 2007 SP2 not 2010. I was hoping your tool would still work in this environment too (I figured this since AD already has the attribute thumbnailPhoto). I would just like to get the pictures in AD so when we upgrade to 2010 we will have that piece done.
If this script requires 2010 I appologize for wasting your time and not mentioning it earlier.
Robert, yeah this requires the Exchange 2010 Management Shell. The Import-RecipientDataProperty cmdlet is specific to Exchange 2010 and that’s what the script uses to import the photos.
I forgot to add that my IP Subnets are in AD.
Is there an easy way to remove a picture?
There are only Import and Export cmdlets for the photos and unless I am missing something obvious, I don’t see a way to simply remove a picture. You should be able to clear the users thumbnail photo attribute value using ADSIEdit and that would remove the picture.
It should be able to clear the attribute:
http://msexchangeteam.com/archive/2007/10/19/447301.aspx
Maybe worth a try adding this to your gui.
The command to remove a picture is: Set-Mailbox (username) -RemovePicture
Thanks Chris, I didn’t know about the RemovePicture parameter on the Set-Mailbox cmdlet.
Im very new with exchange 2010. The only issue Im having is how to create New Mailbox Database under Data Management. When I try to create I will to find the server but nothing comes up. I also tried the EMS with this line.
New-MailboxDatabase -Name “MailboxDatabase01″ -EdbFilePath D:\DatabaseFiles\MailboxDatabase01.edb
Then it prompts for server. Type in server then tells me “couldnt perform the operation b’cause the server “server”isn’t a mailbox server.
Any suggestions is much appreciated. Thanks.
Hi Mike,
Brilliant! Was holding off implementing this due to the admin it would take – now I can get HR to do their own work
Couple of questions I was hoping yoiu could help with.
1. What permissions need I give a user or group (HR) on the Ex2010 server to allow the script to run?
2. I had initially added a test photo manually but whilst it UL’d fine the image doesn;t appear in Outlook2010. It was searching for answers that I found your script. The tool confirms the image is UL’d and in AD but no-go in Outlook. Any idea or suggestions as to where I should start looking?
Thanks again, great, great tool!
Benjamin
Hi Benjamin, thanks for your comment.
1. You’ll need to use RBAC to assign the Import-RecipientDataProperty and Export-RecipientDataProperty EMS cmdlets to your staff. You can create a custom role or use the existing Migration role that contains those cmdlets.
The docs on RBAC can be found here:
http://technet.microsoft.com/en-us/library/dd298183.aspx
2. As far as the photo not showing up in Outlook, are you working in online mode or cached mode? If you’re working in cached mode, you’ll want to follow the steps at the end of this article to configure the OAB:
http://msexchangeteam.com/archive/2010/03/10/454223.aspx
Hey Mike,
Brilliant. I had to enable PS scripts on the client systems as per this link:
http://www.itexperience.net/2008/07/18/file-cannot-be-loaded-because-the-execution-of-scripts-is-disabled-on-this-system-error-in-powershell/
but we’re now rocking. Thanks a lot for your help and the tool!
Benjamin
Excellent, thanks for the update
Hello!
Thanks for the great script. However I cannot get it to work under Server2008/Exchange 2007.
The Import-RecipientDataProperty cmdlet is not found although it seems to work for other people.
See here: http://blogs.technet.com/b/ilvancri/archive/2010/01/08/follow-up-import-recipientdataproperty.aspx
Any idea how to get the cmdlet running?
Hi Herald,
The Import-RecipientDataProperty cmdlet is an Exchange 2010 cmdlet, so that is why it’s not working for you on Exchange 2007. You could use AD PowerShell or the Quest cmdlets to import the photos manually. See the following links for examples:
http://www.mikepfeiffer.net/2010/06/how-to-use-ad-powershell-to-manage-outlook-2010-user-photos-with-previous-versions-of-exchange/
http://technodrone.blogspot.com/2010/06/updating-pictures-for-users-in-ad.html
I have completed these steps and the photos appear in various places within outlook except for in the top, right of a message. We are using Exchange 2010 and Outlook 2010. If I have the people pane on, it displays in the bottom, among other places. Any thoughts?