As you all know by now there are several areas you can elevate pictures from Active Directory. What I mean is that you can add a picture to the thumbnailphoto attribute in Active Directory and it will be displayed in Outlook (not only Outlook 2010: http://www.stevieg.org/tag/thumbnailphoto/ ) and Lync. You could also achieve this on SharePoint. But what you probably did not know is that you can also automate the process of setting a user tile picture (User picture) on the start menu on Windows7 clients reading the picture from Active Directory. I will explain the process.
First we need to add a picture to accounts in Active Directory. This can be achieved in many ways. One way is to use the dll from oLID: http://www.dewdney.co.uk/adext/adext.zip (readme inside zip file), another way is to use this tool: http://www.cjwdev.co.uk/Software/ADPhotoEdit/Info.html. A Third option is to use PowerShell. In order to import a picture using powershell you can use this code (you need Active directory modules):
I recommend using one of the gui methods, because they shrink the size of the image before they are written to the thumbnailphoto attribute. I like the adext.zip extension best. Here are screenshots when I add a picture to a user after I have installed the adext.zip:
I choose to write the picture to a temporary location and the adding it as a user account pictures using this exe file.
Compiled in X64 – .Net framework 3.5
( This is a compiled version of this code: http://joco.name/2010/12/06/i-discovered-the-new-windows-user-tile-api/ (Thanx Joco!) )
You can compile this code yourself by copying the code from Joco into notepad and save it with a .cs extension. Then you open up cmd and browse to windowsMicrosoft.netFramework(64 if you want 64 compiled version)v3.5. Here you will find a file called csc.exe.
(Note: I compiled this in 3.5, because this is default installed in Windows 7, if you were to use .Net framework 4 you have to make sure that this is deployed to every workstation since the compiled exe file uses the version you compile it in.)
This is used for compiling code. Inputs are like this: csc.exe c:codeusertile.cs . This will create the usertile.exe inside the path where you execute csc.exe. So there is a crash course in compiling code. J
Okay, back to the automating usertile project. For simplicity in the script I copy the usertile.exe to netlogon folder. Here is the powershell script I use during logon to set the picture on the user account:
As you can see it will connect to my logged on user in Active Directory. Then it will read the thumbnailphoto attribute out to %temp%domain+user.jpg. It will then call the usertile.exe and use this temporary domain+user.jpg file. The next step is to add this as a logon script.
As you all know there is now a great possibility to run PowerShell script at logon with the help of Group Policy.
I created the Usertile.ps1 inside the GPO.
And voila you now have your picture from Active directory on your start menu and logon screen.
Another Cool thing is that if you change the picture in active directory to another picture, this will also change the picture on the computers since the script will always run at logon and will overwrite the existing picture.
And please feel free to comment this post. Remember that this was all tested in a X64 environment. I do not know if this will work in X86 (the usertile.exe). If you have a mix of X86 and X64 you probably need to compile an X86 version of usertile and use that instead.
I must also give credz to xtremedeployment for the reverse engineering of usertile: http://deployment.xtremeconsulting.com/2010/06/23/usertile-automation-part-1/ (Great article)
Pictures in Sharepoint:
Pictures in Lync:
– http://sysnetadmin.changar.com/2011/02/10/using-outlook-2010-and-thumbnailphoto-in-active-directory/ – Note that it is not necessary to make the attribute replicate to Global catalog (only if you are in a multi domain forest)