Saturday, April 26, 2014

Windows 8 / Windows 8.1: Set Account Picture from active directory

There is lots of posts we can find from internet that showing the procedures to set user tile from active directory for a Windows 7 domain member computer.

But there is no successful guides & tools available on Internet to set account picture from active directory on a Windows 8 or Windows 8.1 computer. I cannot understand why Microsoft not including a built in feature for this simple (but a dream of all I.T administrators) option.

I have decided to spend my weekend to find a solution for this. I have developed a tool (In VB.net) and group policy procedure to set account picture from active directory on a Windows 8 or Windows 8.1 domain computer. I wish to share it with you all.

Step 1. Create a GPO in your server & ensure it is applicable only to Windows 8 & Windows 8.1 clients by using a WMI filter

[Note: If you have already similar a group policy, you can re-use the same instead of creating a new. Then ignore this step]
You can create a WMI filter using below Query, give a proper Name (In my case: Win8 &  8.1 OS Computers)

SELECT * FROM Win32_OperatingSystem WHERE (Version LIKE "6.2%" or Version LIKE "6.3%" ) AND ProductType = 1

Give a proper name to newly created group policy, In my case I am using "ClientOS Settings-Win8 & 8.1" and ensure you are selected the "Win8 &  8.1 OS Computers" WMI filter to ensure newly created GPO is only applicable to Windows 8 and Windows 8.1 clients.



Step 2. Download and save “UserTile8.exe” to a shared folder that everyone can access.

[In my case I have used \\<DomainName>\NETLOGON\UserTile.  It will ensure everyone can access this file with read only access & also nobody can alter or remove it]

Download Links:
Exe: Click here

Source Code (In Zip Format): Click here
Exe in zip format: Click here


UserTile8.exe I have developed in .NET framework 4 (VB.net). This utility will find thumbnailPhoto of the current user from active directory & convert to different sizes (200x 200, 240x240, 40x40, 448x448 and 96x96) with some enhancements in picture quality. These all different size images are required in Windows 8 & Windows 8.1. After the conversion, it will be stored in “C:\ProgramData\AccountPictures” folder with UserSID+ImageSize.jpg format

Then it will update the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrentVersion\AccountPicture\Users\<SID> registry values. In windows 8 & 8.1 Account picture settings are keeping in this registry.  But unfortunately users don’t have the permission on this registry. Here we are going to give the required permission using the GPO we have created earlier (see next step)
I have included the source code of UserTile8. You can download, refer and make any changes & re-compile if required. Without any changes you can simply use UserTile8.exe in case you don’t have .NET programming knowledge.

Step 3 Edit the group policy ClientOS Settings-Win8 & 8.1

Go to Computer Configuration->policies-> Windows Settings -> Security Settings – Registry
Right Click on Registry and select Add Key


Add the below Key:
MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users


Give Full Permission on this key (and sub keys) to <Domain>\Users


Ensure security is applies to this Keys and sub keys from advanced security


Also make sure you have selected “Replace Existing permission on all sub keys with inheritable permissions.”


Now we have to enable an option to execute UserTile8.exe on user login. Here I am going to make a scheduled task in group policy for that. (Even you can make your own procedure like logon script to do it)

To make a scheduled task in GPO:
Edit the group policy ClientOS Settings-Win8 & 8.1

User Configuration-> Preferences->Control Panel Settings -> Scheduled Tasks
Right Click and select New Sheduled Task (At lest Windows 7) Option

From General Tab
Set Name as: SetUserTile
Select Hidden ( to ensure UserTile8 is hidden on background when a user login to the computer)

From Triggers Tab
Create a new trigger and select Begin the task: At Login, Any User

From Actions Tab
Create New Action Select Action “start Program”
From Program Script Option
Select the UserTile8.exe from the shared folder.
Press Ok buttons and save it.

All the settings are ready now.

To test it is working or not, go to a Windows 8.1 client pc.
Run gpupdate from command prompt to update the group policy immediately.
Logoff and login twice. (On first login, UserTile8 executes & sets all required data. But to after second login only it will be refreshed by windows.)

In case you have any comments, I am happy to answer (surely on my free time).

Also please visit my new post for trouble shooting points

If you find this tool is helpful for you, you can consider to offer a coffee by pressing the donate button.

View Jimmy Mathew's profile on LinkedIn
 

30 comments:

  1. This isn't working for me. I don't have a C:\ProgramData\AccountPictures folder either. I'm in Win 8.1

    ReplyDelete
    Replies
    1. Please double check & ensure you have completed all the steps as per this blog. It is compatible with 8.1. (Both 32 & 64)
      There is no need to to crate the folder, once the UserTile8.exe executed as per the scheduled task configured in group policy, it will create that folder automatically.

      Delete
    2. Does it also work with Server 2012 / 2012 R2 ?, i would like to use it in my Demo Enviroment but there we mainly Login to Server not Workstations.

      Delete
    3. Yes, it should work with Windows Server 2012 / server 2012R2. Change the WMI filter as per your requirement
      (See step-1) To include both server and client OS systems, change the WMI filter as: SELECT * FROM Win32_OperatingSystem WHERE (Version LIKE "6.2%" or Version LIKE "6.3%" )

      Delete
  2. The registry key should be "MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users" (plural users) instead of MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\User

    ReplyDelete
    Replies
    1. Sorry for the typing mistake. Made the changes in post, thanks.

      Delete
  3. This created the pictures for me in C:\ProgramData\AccountPictures but does not apply the picture for the account

    ReplyDelete
    Replies
    1. Same here... created the folder, but did not set the picture to the account.

      Delete
    2. Hello Dave & TIM
      There was a typing mistake in this article. (It is corrected now)
      Please ensure the registry key you have created in the Step-3 is
      MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users

      (Before it was mistyped as \User, a big sorry)

      Delete
  4. Thank you for your program.
    There is some misprint in the article.
    In step 3 you wrote:
    Add the below Key:
    MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\User
    But you should add "s" to the end "AccountPicture\UserS"

    ReplyDelete
    Replies
    1. Sorry for the typing mistake. Made the changes in post, thanks.

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Not working. Any patch or something?
    Tested on Windows 8.1

    ReplyDelete
    Replies
    1. There was a typing mistake in this article. (It is corrected now)
      Please ensure the registry key you have created in the Step-3 is
      MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users

      (Before it was mistyped as \User, a big sorry)

      Delete
  7. Hi there, thanks heaps for your code, I was able to re-write it as a PowerShell script. Works great! Check it out here if you are interested: http://blog.jourdant.me/ps-setting-windows-8-account-picture-from-ad

    ReplyDelete
  8. It Works great! thx!! I now have account Pictures on both servers and clients in my organization by using the following WMI filter, and setting up everything in GPO.
    SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.2%" or Version LIKE "6.3%"

    ReplyDelete
  9. Hello everyone. The script is running at startup workstations, see the photo of the Active Directory and writes them in the folder c: \ ProgramData \ AccountPictures but does not update the picture on the local machine ... Someone succeeded make it work??

    ReplyDelete
    Replies
    1. Please check Step 3 Edit the group policy ClientOS Settings-Win8 & 8.1... Ensure the registry having the proper security.
      To update the group policy settings in clients you can try gpupdate command from client.

      Delete
  10. c:\ProgramData\AccountPictures can not be created. My Forest and Domain Functional Level(s) are W2K8R2 and DCs are W2k8R2. Is it be the cause of the folder can not be created?

    ReplyDelete
    Replies
    1. Please check trouble shooting points : http://www.parackattu.com/2014/09/account-pictures-from-active-directory.html

      Delete
  11. I am not sure what I am doing wrong, but just not working. Works if I click it manually on the 8.1 workstation.
    But from Server 2012 R2 created the GPO exactly as described and added the WMI Filter under name space root\CIMv2. For GPO removed Authenticated Users and Added Domain/Users.
    Created schedule task at least windows 7 and down the below next to tick hidden, selected Windows 7. Added action etc. Then from 8.1 client machine gpupdate and logged off and on twice. But still no luck. I even tried without WMI Filter.

    Please assist.

    ReplyDelete
    Replies
    1. Please check trouble shooting points: http://www.parackattu.com/2014/09/account-pictures-from-active-directory.html

      Delete
  12. can not downlaod UserTile8.exe, from googe disk, it says: Unfortunately, the file currently can not view or download.

    Too many users have viewed or downloaded file. Please try again later to access the file. If the file you are trying to access is particularly large or is shared with many people, it may take 24 hours to be able to view or download. If the file can not be accessed even after 24 hours, please contact your domain administrator.

    ReplyDelete
    Replies
    1. Alternate Download Locations:

      EXE:
      http://www.mediafire.com/download/192om6vlmv8clj4/UserTile8.exe

      EXE (ZIP) ->
      http://www.mediafire.com/download/m22q74jfcrdgz5j/UserTile8_exe.zip

      Source Code (ZIP) ->
      http://www.mediafire.com/download/08j72w79d6lca0m/UserTile8_SorceCode.zip

      Delete
  13. Thanks for the post, just implemented it, and it works great. Any tips for doing this on Windows 7?

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Any thoughts on updating this wonderful tool for Windows 10?

    ReplyDelete
  16. This appears to work for Windows 10...
    http://blog.jocha.se/tech/ad-user-pictures-in-windows-10

    ReplyDelete