Wednesday, April 24, 2013

Programmatically hiding the Windows 8 Start Screen during an MDT Task Sequence

I've seen this question come up a few times in the Microsoft Deployment Toolkit Forum.  The gist of the request is the ability to see the MDT Task Sequence UI (step and progress bar) during a Capture or, more likely, a Deploy Task Sequence when using Windows 8 (or Server 2012).  This is complicated by the Start Screen, but can it be done...
Do you really think I'd write a blog and muddle through PowerShell if you couldn't? : )

There are several blog posts on ways to "skip" the Start Screen.  Most involve the use of the Task Scheduler and a call to Explorer.exe with a special shell parameter to get the Desktop to show.  I wasn't looking to make a bunch of Unattend.xml changes or customize the default scripts files to accomplish this and figured there had to be a better way.

I knew I should try to do this in PowerShell and MMS 2013 only solidified that belief (yes, I've been trying to figure this out for a few weeks).  The first thing was to figure out how to check for the Start Screen being active.  The answer to this was the iAppVisibility::IsLauncherVisible interface.  Unfortunately, I had no clue how to use an Interface from PowerShell.  Thanks to Kazun and the helpful PowerShell Forum community, I got my answer pretty quickly.

Now that I could check for the Start Screen, I had to figure out how to make it go away when I wanted.  I decided the SendKeys would be best and just use the keyboard CTRL+ESC combo to toggle to the Desktop.  This worked great... so long as the Desktop had already been viewed once.  If you try this right after a reboot, it doesn't work.  I spent a bunch of time trying to figure out alternatives to make this work, things like calling Explorer.exe with those special parameters, and other really lame ideas (obviously, because they didn't work).

Then I hit the easy idea that I should have thought of first... "Desktop+Enter".  It was too simple!  There's no way that could be the answer... but it was (thankfully, I was starting to go a little crazy!).  It works on a fresh reboot.  So now it was time to wrap my two key pieces in a little PowerShell (which I still stink at) and share with the world to hopefully make at least one person's day.

I drop the script into my Deploy\Scripts folder and call it after a reboot or anything that causes a reboot (like Windows Update) and as soon as LTIBootstrap loads and picks up the next step, it detects the Windows 8 Start Screen and swaps it over to the Desktop.

Note that since Windows Update does force a reboot and then picks up on the same task, the Start Screen doesn't get triggered until the Task Sequence finishes the Windows Update step.  No way around this (without modifying default files).

- DCtheGeek

1 comment:

  1. Thank you so much! I'm still a rookie, so help from people like you is very much appreciated.

    I'm going to add this script to my deployment right away!