Hiding First Setup During OSD

I have been working on a task sequence all week with a custom background showing the progress of the task sequence on different images. However when you get to the Windows setup, the black “Setup is preparing…” window comes up, if you have lots of post Windows tasks like my customer such as configuration, software installs etc then you never see your swanky background. Can we remove the background? Most certainly can.

FirstUxWnd

You have all seen this before, you are running your task sequence with a custom background maybe just the defaults from the UDI wizard in MDT, or your own custom background. However, when you get to this phase your background disappears.

We can hide this window using some compiled C# which invokes a couple of API methods to hide the window. The two we use here are FindWindow and ShowWindow. We first need a couple of API calls which we do as follows:

[DllImport("user32.dll", SetLastError = true)] internal static extern int FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", SetLastError = true)] internal static extern int ShowWindow(int hwnd, int nCmdShow);

Then from here it is a simple case of getting the handle of the window which we know to be FirstUxWnd and then issuing a command to hide the window.

// Hide Window : 0 = Hide, 1 = Show
if (hwnd != 0) { ShowWindow(hwnd, 0); }

Sorry the code doesn’t wrap very well at all in WordPress, however I have compiled the executable which you can find on my SkyDrive: http://sdrv.ms/15IFSYJ

If you would like the basic source code, then you can also find this on my SkyDrive: http://sdrv.ms/15IGfCR

Hope this is something people will find useful especially for making your state restore phase back to it’s pretty self.

Advertisements

Tags: , , , , , , , , ,

About Martyn

Martyn is one of the Senior Cloud Architects and DevOps Team Leader at one of the worlds leading Cloud Transformation Specialists Inframon. Martyn is responsible for the architecture of some of the largest Azure deployments in EMEA and is a advisor to a many businesses on their strategies. Martyn is a regular speaker at Microsoft events and community events on Azure and DevOps, giving his insight to a growing number of audiences.

One response to “Hiding First Setup During OSD”

  1. Jack says :

    Have you looked at a way to do the same thing in Windows 10 yet? It doesn’t seem like any of the previous methods works to allow BGInfo custom screens to display after the “Setup Windows and SCCM Advanced Client” task…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: