Jump to content

Change a User Tile with Setupcomplete.cmd


Recommended Posts

Not for Windows 8
This is not default tile with $OEM$

Someone asked me if you could change the user tile using the xml. Nothing there unless you use oobe.xml
I prefer not to do that so I looked and came up with this

From http://joco.name/2010/12/06/i-discovered-the-new-windows-user-tile-api/
Using his code compiled to exe
 

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]);}}}

Copy and paste the above code lines in notepad.
Save the file as UTF8 and with an extention of .cs
For example Tile_replace.cs and save it on desktop

Open a command prompt on whatever directory you saved the file
Compile the code with the following command from command prompt:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe Tile_replace.cs

 

EDIT:

Use latest .NET you have for this

C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe

You get a Tile_replace.exe I copy somewhere like DVD\sources\$OEM$\$1\Install
Copy the picture there also. .jpg or .png

Using DVD\sources\$OEM$\$$\setup\scripts\setupcomplete.cmd I do this
 

rem Change User PictureCMD /C %systemdrive%\Install\Tile_replace.exe Maxxpsoft %systemdrive%\Install\Maxxpsoft.jpg

That's it. When login screen appears my Tile is set
post-9484-0-47383500-1365874634_thumb.jp

I'll include the compiled exe and code here

Tile_replace.zip

Edited by maxXPsoft
Link to comment
Share on other sites

  • 1 year later...

  • 3 weeks later...

i used this on a windows 7 sp1 system. But Always get the error that the Tile_replace.exe is not working anymore

 

can you help me ?

I update original post

 

Use latest .NET you have for this

C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe

 

works for me

Edited by maxXPsoft
Link to comment
Share on other sites

Threw that p/invoke inside an add-type so you might not need an external.exe for this trick. 

Add-Type -Language CSharp -TypeDefinition @"using System;using System.Runtime.InteropServices; namespace FejesJoco{    public class Program    {        [DllImport("shell32.dll", EntryPoint = "#262", CharSet = CharSet.Unicode, PreserveSig = false)]        public static extern void SetUserTile(string username, int whatever, string picpath);         [STAThread]        public static void Main(string[] args)        {            SetUserTile(args[0], 0, args[1]);        }    }}"@[FejesJoco.Program]::Main("Maxxpsoft" "%systemdrive%\Install\Maxxpsoft.jpg")
Edited by MrJinje
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...