Monday, May 23, 2016

Create Basic WinPE USB Drive - Windows 10


Scenario

You want to create a basic (no frills) bootable drive with WinPE on it.  In this case we will be using the Windows 10 ADK tools.

What you will need:



Instructions for Creating Bootable USB


  1. Download and install Windows 10 ADK
  2. Open Deployment and Imaging Tools Environment as administrator
  3. Insert USB into USB port (you will be wiping this drive so use a USB device that you can wipe)
  4. Enter the following commands to copy the pre-installation environment files to your hard drive and then make a bootable USB drive from that.

copype amd64 c:\TEMP\WinPEx64Win10 
MakeWinPEMedia /UFD c:\TEMP\WinPEx64Win10 e:

In our example above, we are copying the WinPE files to c:\TEMP\WinPEx64Win10 and then making a USB drive where the USB drive letter is e:

Viola! You should now have a USB drive that you can use to boot into a WinPE environment. Awesome right!  Well sort of...

The boot drive is pretty basic. It doesn't have the imagex tool in it so you won't be able to use it to image computers yet.  Also, you will just get a command prompt when you boot up to it.  Additionally, there aren't any third party storage or network drivers in it yet.  So if you want to have those loaded in your WinPE environment, you will need to add those.

Adding ImageX to Your Bootable Drive

So let's make our USB drive more useful.  Let's add imagex to it.  If you recall, we used the copype command to copy our WinPE files to c:\TEMP\WinPEx64Win10.  We will now go to the boot.wim in that folder structure, mount it, add imagex, unmount it, and then copy it to our USB drive.


  1. First mount your boot.wim file.  This will be located here: c:\TEMP\WinPEx64Win10\media\sources
  2. You can manage your wim file by using dism commands in the Deployment and Imaging Tools Environment, or by using Gimagex, or by using the DISM GUI.  In our example, we will use the DISM GUI.  You can download that tool here.
  3. Open the DISM GUI tool as an administrator and under the Mount Control tab select Choose WIM.  Navigate to your boot.wim file.
  4. Select Choose Folder under Mount Location and select a folder you want to mount the .wim to.


NOTE: The paths here will be different for you.  This is just the location that I choose to put my boot.wim and mount folder.

You should now see the mounted files in your mount folder:


You will need to copy the imagex tool from your local hard drive, to the mounted "Windows\System32" folder.  You can find the imagex tool (x64) in the following location:

C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\DISM\imagex.exe

Copy that imagex.exe into your mounted .\Windows\System32 folder and then dismount the WIM file.  You can dismount the mounted WIM file using the DISM GUI tool.  Select Dismount WIM and then select yes when prompted to commit changes.

NOTE: I recommend closing out any explorer.exe windows before dismounting.  I have seen some issues with trying to dismount a WIM while explore.exe is open and you are browsing to the mount directory.

You can now navigate to your local copy of the boot.wim and copy it to your USB drive.  Overwrite the existing boot.wim.

Copy c:\TEMP\WinPEx64Win10\media\sources\boot.wim

to

e:\sources\boot.wim

Reboot a computer and have it boot to your USB drive.  Now when the command prompt comes up, you can navigate to .\Windows\System32\ and launch the imagex utility.

This is a basic build of a WinPE environment with the imagex utility.  If you are going to use this extensively, I recommend adding additional portable tools along with some kind of start menu.  I have used PStart in the past, along with other portable apps, to make a more robust WinPE environment.

Additional Resources

https://msdn.microsoft.com/en-us/windows/hardware/commercialize/manufacture/desktop/winpe-create-usb-bootable-drive
https://technet.microsoft.com/en-us/library/hh825109.aspx
https://technet.microsoft.com/en-us/library/cc766093(v=ws.10).aspx
https://technet.microsoft.com/en-us/library/cc721977(v=ws.10).aspx
https://technet.microsoft.com/en-us/library/cc749055(v=ws.10).aspx

No comments:

Post a Comment