Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I found this nice article of how to add a user tile image via code:

http://joco.name/2010/12/06/i-discovered-the-new-windows-user-tile-api/
This is also explained in depth here: http://msitpros.com/?p=1036

I have problems with doing this in Windows Server 2012. Whenever I run the code:

using System;
using System.Runtime.InteropServices;

namespace FejesJoco
{
    class Program
    {
        [DllImport("shell32.dll", EntryPoint = "#262", CharSet = CharSet.Unicode, PreserveSig = false)]
        public static extern void SetUserTile(string username, int whatever, string picpath);

        [STAThread]
        static void Main(string[] args)
        {
            SetUserTile(args[0], 0, args[1]);
        }
    }
}

However it doesn't do anything.

There is an example from Microsoft using an App to get the current profile image: http://code.msdn.microsoft.com/windowsapps/Account-picture-name-sample-912baff1 , but I am also not able to set the image that way. The only way which worked for me is to install the Desktop experience Feature and set the image manually via PC Settings.

Can anyone get this to work and add a user tile image via code?

share|improve this question
This is probably a better question for Stack Overflow as it's programming related. I'm certainly interested as we use that same code to update User's tiles with their AD Photo too. Have you tried using the pre-compiled program provided on that detailed page? – Chris S Nov 26 '12 at 14:42
Not only the precompiled program, I also compiled it myself. In the comments you can see that people are having problems with Windows 8 as well. – moontear Nov 26 '12 at 17:02

closed as off topic by SvW, Michael Hampton, MDMarra, Ward, John Gardeniers Nov 26 '12 at 13:46

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.