%3CLINGO-SUB%20id%3D%22lingo-sub-258477%22%20slang%3D%22en-US%22%3EDown%20and%20Dirty%20WinPE%20USB%20for%20Surface%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-258477%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3EFirst%20published%20on%20TechNet%20on%20Apr%2011%2C%202016%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3EHi%20everybody!%20My%20name%20is%20Stephen%20Mathews%20and%20you%20may%20know%20me%20from%20my%203-part%20PowerShell%20Basics%20video%20series%20on%20%3CA%3E%20Taste%20of%20Premier%20%3C%2FA%3E%20.%20Today%20I'm%20here%20to%20show%20how%20to%20create%20a%20bootable%20Windows%20PreInstallation%20Environment%20USB%20drive%20to%20use%20on%20our%20Microsoft%20Surface%20devices.%20I%20was%20onsite%20with%20one%20of%20my%20customers%2C%20as%20a%20Premier%20Field%20Engineer%20often%20is%2C%20and%20was%20asked%20how%20to%20wipe%20a%20Surface%20device.%20My%20go-to%20method%20is%20to%20insert%20my%20trusty%20Windows-To-Go%20USB%20and%20boot%20into%20my%20Operating%20System%2C%20and%20then%20use%20Disk%20Manager%20to%20delete%20and%20format%20the%20host's%20now%20attached%20hard%20drive%3B%20unfortunately%2C%20I%20had%20left%20my%20WTG%20drive%20at%20home.%20The%20alternate%20method%20I%20use%20to%20access%20WinPE%20is%20to%20PXE%20boot%20the%20machine%20into%20the%20customer's%20Microsoft%20Deployment%20Toolkit%20on%20their%20Windows%20Deployment%20Server%3B%20however%2C%20the%20customer%E2%80%99s%20Surface%20had%20no%20network%20connectivity.%20You%20can%20also%20use%20MDT%20to%20create%20bootable%20media%20allowing%20access%20to%20the%20WinPE%20directly%20on%20a%20USB%20drive%20instead%20of%20using%20PXE%20boot%2C%20alternately%2C%20most%20image%20customization%20tools%20introduce%20a%20WinPE%20prior%20to%20deployment%20as%20well.%20Alas%2C%20the%20admins%20I%20was%20working%20with%20did%20not%20have%20access%20to%20the%20MDT%20server%20and%20I%20didn't%20want%20them%20to%20have%20to%20use%20DISM%2C%20ImageX%2C%20or%20BCDEdit%20programs%20either%2C%20I%20just%20needed%20a%20simple%20WinPE%20that%20they%20could%20create%20at%20their%20desks.%20After%20quite%20a%20few%20rounds%20of%20trial%20and%20error%2C%20I%20arrived%20at%20a%203%20step%20solution%3A%20%3CSTRONG%3E%20%3CEM%3E%20%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3E%20Step%201%3A%20Create%20a%20bootable%20USB%20drive%20%3C%2FSPAN%3E%20%3C%2FEM%3E%20%3C%2FSTRONG%3E%20Attach%20an%20empty%20(or%20soon%20to%20be%20erased)%20USB%20drive%20to%20your%20system.%20I%20used%20an%20ancient%201GB%20USB%20flash%20drive%20that%20the%20customer%20found%20in%20an%20equally%20ancient%20desk%20drawer.%20c%3A%5Cwindows%5Csystem32%26gt%3B%20diskpart%20diskpart%26gt%3B%20list%20disk%20diskpart%26gt%3B%20select%20disk%20%23%20diskpart%26gt%3B%20clean%20diskpart%26gt%3B%20create%20partition%20primary%20diskpart%26gt%3B%20select%20partition%201%20diskpart%26gt%3B%20active%20diskpart%26gt%3B%20format%20fs%3Dfat32%20quick%20diskpart%26gt%3B%20assign%20letter%20x%20%3CA%3E%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20728px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F52763iE382400931B7319C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3C%2FA%3E%20Reference%3A%20%3CA%3E%20Prepare%20the%20UFD%20%3C%2FA%3E%20%3CSTRONG%3E%20%3CEM%3E%20%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3E%20Step%202%3A%20Download%20and%20Install%20the%20WinPE%20tools%20%3C%2FSPAN%3E%20%3C%2FEM%3E%20%3C%2FSTRONG%3E%20Download%20the%20Windows%20ADK%20for%20your%20operating%20system%20%3CA%3E%20here%20%3C%2FA%3E%20.%20Install%20Windows%20PreInstallation%20Environment%20(Windows%20PE)%2C%20you%20can%20deselect%20the%20other%20components.%20%3CA%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20777px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F52764i52C00ECDC7C48982%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FA%3EOpen%20the%20Deployment%20and%20Imaging%20Tools%20and%20run%20the%20copype%20command%20with%20the%20amd64%20architecture.%20%3CADK%20install%3D%22%22%20path%3D%22%22%3E%20copype.cmd%20amd64%20c%3A%5Ctemp%5Cwinpe_amd64%20Copy%20the%20resulting%20media%20folder%20to%20the%20root%20of%20the%20USB%20drive.%20In%20the%20screenshot%2C%20I'm%20sending%20the%20output%20to%20a%20log%20file%2C%20this%20is%20not%20necessary.%20The%20%E2%80%9C%2Fxd%E2%80%9D%20switch%20is%20skipping%20the%20additional%20language%20copies%20of%20the%20boot%20files%2C%20that%20can%20be%20dropped%20as%20well.%20The%20copy%20may%20take%20a%20few%20minutes%20based%20on%20the%20speed%20of%20your%20USB%20device.%20robocopy%20c%3A%5Ctemp%5Cwinpe_amd64%5Cmedia%20x%3A%20%2Fe%20%2Fxd%20*-*%20%3CA%3E%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20848px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F52765iAEAB12BC3AA2290F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3C%2FA%3E%20Reference%3A%20%3CA%3E%20Set%20up%20a%20Windows%20PE%20build%20environment%20%3C%2FA%3E%20%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3E%20%3CSTRONG%3E%20%3CEM%3E%20Step%203%3A%20Boot%20from%20USB%20drive%20%3C%2FEM%3E%20%3C%2FSTRONG%3E%20%3C%2FSPAN%3E%20Change%20the%20boot%20order%20in%20the%20Surface%20device%20to%20put%20USB%20before%20the%20SSD.%20It%20took%20me%20quite%20a%20few%20attempts%20to%20get%20the%20right%20timing%20of%20Power%20%2B%20Volume%20Up%20buttons%2C%20I%20recommend%20patience%20during%20this%20process.%20Configure%20Alternate%20System%20Boot%20Order%20%26gt%3B%20USB%20-%26gt%3B%20SSD%20%3CA%3E%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20680px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F52766i4BD97FB9AE444BCF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3C%2FA%3E%20At%20this%20point%2C%20it%20should%20boot%20directly%20into%20the%20USB%20drive.%20The%20screen%20will%20pause%20at%20the%20Surface%20logo%20while%20the%20USB%20is%20read.%20If%20it%20goes%20directly%20to%20the%20spinning%20dots%2C%20then%20it%20did%20not%20boot%20to%20USB%20successfully.%20Pardon%20the%20image%2C%20although%20I%20think%20the%20faux%20sunburst%20is%20a%20nice%20touch.%20%3CA%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20670px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F52767i011E250F50863CC7%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FA%3ENote%3A%20For%20older%20Surfaces%20and%2For%20if%20there's%20no%20boot%20order%20setting%2C%20press%20Power%20%2B%20Volume%20Down%20to%20boot%20from%20USB.%20Reference%3A%20How%20do%20I%20use%20the%20BIOS%2FUEFI%3F%20Once%20I%20was%20in%20the%20WinPE%20I%20used%20the%20diskpart%20commands%20in%20Step%201%20to%20delete%20all%20the%20disk%E2%80%99s%20partition%20information%2C%20re-partition%20into%20a%20single%20partition%2C%20and%20finally%20format%20it%20without%20the%20quick%20parameter%20since%20we%20wanted%20to%20overwrite%20the%20entire%20drive.%20%3CA%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20763px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F52768iFDC6A23E84864653%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FA%3EThere%20you%20go%2C%20a%20simple%20USB%20bootable%20WinPE%20with%20all%20your%20favorite%20System32%20executables%20available%2C%20all%20wrapped%20in%20a%20250MB%20package.%20I%20hope%20this%20was%20useful%20to%20you%20and%20saves%20you%20time%20in%20the%20future.%20Thanks%20for%20reading%2C%20Stephen%20Mathews%2C%20Platforms%20PFE%3C%2FADK%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-258477%22%20slang%3D%22en-US%22%3E%3CP%3EFirst%20published%20on%20TechNet%20on%20Apr%2011%2C%202016%20Hi%20everybody!%20My%20name%20is%20Stephen%20Mathews%20and%20you%20may%20know%20me%20from%20my%203-part%20PowerShell%20Basics%20video%20series%20on%20Taste%20of%20Premier.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-258477%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EStephenMathews%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

First published on TechNet on Apr 11, 2016
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 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. 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 *-* 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 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. 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. 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