Down and Dirty WinPE USB for Surface

Hi everybody! My name is Stephen Mathews and you may know me from my 3-part PowerShell Basics video series on Taste of Premier. Today I’m here to show how to create a bootable Windows PreInstallation Environment USB drive to use on our Microsoft Surface devices.

I was onsite with one of my customers, as a Premier Field Engineer often is, and was asked how to wipe a Surface device. My go-to method is to insert my trusty Windows-To-Go USB and boot into my Operating System, and then use Disk Manager to delete and format the host’s now attached hard drive; unfortunately, I had left my WTG drive at home. The alternate method I use to access WinPE is to PXE boot the machine into the customer’s Microsoft Deployment Toolkit on their Windows Deployment Server; however, the customer’s Surface had no network connectivity.

You can also use MDT to create bootable media allowing access to the WinPE directly on a USB drive instead of using PXE boot, alternately, most image customization tools introduce a WinPE prior to deployment as well. Alas, the admins I was working with did not have access to the MDT server and I didn’t want them to have to use DISM, ImageX, or BCDEdit programs either, I just needed a simple WinPE that they could create at their desks. After quite a few rounds of trial and error, I arrived at a 3 step solution:

Step 1: Create a bootable USB drive

Attach an empty (or soon to be erased) USB drive to your system. I used an ancient 1GB USB flash drive that the customer found in an equally ancient desk drawer.

c:\windows\system32> diskpart

diskpart> list disk

diskpart> select disk #

diskpart> clean

diskpart> create partition primary

diskpart> select partition 1

diskpart> active

diskpart> format fs=fat32 quick

diskpart> assign letter x

clip_image002

Reference: Prepare the UFD

Step 2: Download and Install the WinPE tools

Download the Windows ADK for your operating system here.

Install Windows PreInstallation Environment (Windows PE), you can deselect the other components.

clip_image004

Open the Deployment and Imaging Tools and run the copype command with the amd64 architecture.

<ADK Install Path> copype.cmd amd64 c:\temp\winpe_amd64

Copy the resulting media folder to the root of the USB drive. In the screenshot, I’m sending the output to a log file, this is not necessary. The “/xd” switch is skipping the additional language copies of the boot files, that can be dropped as well. The copy may take a few minutes based on the speed of your USB device.

robocopy c:\temp\winpe_amd64\media x: /e /xd *-*

clip_image006

Reference: Set up a Windows PE build environment

Step 3: Boot from USB drive

Change the boot order in the Surface device to put USB before the SSD. It took me quite a few attempts to get the right timing of Power + Volume Up buttons, I recommend patience during this process.

Configure Alternate System Boot Order > USB -> SSD

clip_image008

At this point, it should boot directly into the USB drive. The screen will pause at the Surface logo while the USB is read. If it goes directly to the spinning dots, then it did not boot to USB successfully. Pardon the image, although I think the faux sunburst is a nice touch.

clip_image010

Note: For older Surfaces and/or if there’s no boot order setting, press Power + Volume Down to boot from USB.

Reference: How do I use the BIOS/UEFI?

Once I was in the WinPE I used the diskpart commands in Step 1 to delete all the disk’s partition information, re-partition into a single partition, and finally format it without the quick parameter since we wanted to overwrite the entire drive.

clip_image012

There you go, a simple USB bootable WinPE with all your favorite System32 executables available, all wrapped in a 250MB package. I hope this was useful to you and saves you time in the future.

Thanks for reading,

Stephen Mathews, Platforms PFE