Wednesday, April 26, 2017

How to create a Winodws Server 2016 WinPE image in few simple steps

A WinPE is a strip-down version of a Windows OS which can be used for deployment or troubleshooting purposes.
Here I will explain in simple steps, on how to create a WinPE ISO which you can use in your datacenter.
First things first;

  1. Install Windows ADK 8.1 on a Windows Server 2012 R2 or above Virtual Machine.
    1. Ensure you have selected "Windows PE" & "Deployment Tools"
  2.  Once the installation is complete, click start and goto "Deployment and Imaging Tools Environment" cmd prompt. Make sure you right click and "Run as Administrator"
  3. Create a empty folder (eg C:\WinPE_amd64) which can be used to create a working directory for Windows Pre-installation environment.
  4. Use the following command to create a set of standard Windows PE files.
    copype amd64 C:\WinPE_amd64\winpe
  5. Mount boot.wim to the mount folder which is located in the winpe folder.
    Dism /Mount-Image /ImageFile:"C:\WinPE_amd64\winpe\media\sources\boot.wim" /Index:1 /MountDir:"C:\WinPE_amd64\winpe\mount"
  6. Add packages to your environment as needed. In this case I have added .net Framework and Powershell packages for your reference.

    dism /add-package /image:"C:\WinPE_amd64\winpe\mount" /packagepath:"c:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-WMI.cab"

    dism /add-package /image:"C:\WinPE_amd64\winpe\mount" /packagepath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-NetFx.cab"

    dism /add-package /image:"C:\WinPE_amd64\winpe\mount" /packagepath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Scripting.cab"

    dism /add-package /image:"C:\WinPE_amd64\winpe\mount" /packagepath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PowerShell.cab"

    Refer to this MSDN page for more on this
  7. Now, create a the ISO using the below command.

    Makewinpemedia /iso "C:\WinPE_amd64\winpe" "C:\WinPE_amd64\winpe_amd64.iso" 

Now, try booting your server off the ISO. Should work like charm. Incase you need network drivers, you will have to include the necessary inf files before you create the ISO.
All the best!