Creating custom ISO from Windows 10

Instead of focusing on creating a custom ISO, you should read about WIM image that are meant for deploying in a more efficient way. You will probably need some patients, effort and additional research. It took me like 5 tries to get one working when I first tried to do this.

The steps are a bit complex, but not impossible. I will try to do the best to explain how you can achieve this. If someone has any other ideas/experiences, please leave a comment, and I will include it in my answer.

So lets start with the tools you will need:

  • Windows (10 PRO) installation image/disk/USB
  • A workplace where you can install your Windows 10 Pro and customize it as you like. This can be a Notebook, a PC or a Virtual machine
  • A network share where you will store the WIM image
  • A Bootable Windows live CD/DVD/USB/ISO (BartPE)
    I will not go into details of creating a BartPE live CD, but this should be simple and there are tons of guides that will show you how. Check this for example.
  • A tool to capture Windows and create the WIM image
  • Some basic knowledge of using the command line

  1. Installing and customizing Windows on your PC/Notebook/VM.

  2. Backup.
    After you are done with the customization, you should create backup/snapshot of the current state since step 3 is where I also failed most of the times. And it takes lots of time to do the first step again from the beginning.

  3. Running sysprep.
    Start -> Run -> sysprep

    • On the first dropdown menu, select OOBE - this means that next time when you start Windows it will act like it is the first time running it, asking for new username, language, etc.
    • Check generalize - this is needed if the image will be deployed on multiple PCs, meaning that the driver ID tags and other hardware specific options will be deleted and updated the next time when Windows is started.
    • For shutdown options, you want to select Shutdown since we want to capture the image right after the changes are done.
  4. Capturing the custom Windows.
    You can use multiple tools to capture the current state as a WIM image. You can use imagex, DISM, etc. When I did it, I used gimagex so for now I will use it as an example.

    • You need to download gimagex and save it to your network share.
    • Without starting Windows, boot with your BartPE.
    • type: net use * <path to your network share>
    • type Z: than navigate to your gimagex folder and run the one found in x64.
    • in the capture tab, select the source (your Windows install partition) and select destination (a folder you'd like in your network share)
      you can give a name and description. Leave the rest on default unless you know what you are doing.
    • after the capture was done, you can start your original Windows and check if it starts. If not, something went wrong, do some research, restore your backup and start over from step 3.
  5. Applying the WIM image.

    • You should prepare a script on your network share to make your life easier. I provide you the script you will need:

[image.bat]

@echo off
diskpart /s z:\diskpartrans.txt

[diskpartrans.txt]

select disk 0
clean
create partition primary size=100
select partition 1
format fs=ntfs quick label=system
active
create partition primary
select partition 2
format fs=ntfs quick label=windows
assign letter=g

This will format the drive and create the necessary partitions for your image. You can also manually do it, but it is easier this way.

  • So just as before, you boot with BartPE
  • net use z: <your share>
  • navigate to image.bat and run it
  • once it finishes, navigate to your gimagex and run it.
  • this time use the Apply tab, source is your WIM image on the network share and Destination is G: because this is the letter we assigned in the script.

And that is all. Good luck!


You will need 2 PCs for this -- a test PC and a tech PC (the tech PC will be your PC). You are also going to need 3 USB drives for this:

  • 1 64 GB USB drive to capture the image with.
  • 1 32 GB USB drive for your Windows 10 ISO to be mounted on. (More on this later).
  • 1 32 GB USB drive for Windows PE.

NOTE: You will also need the Windows 10 v1803 ADK -- install everything, it takes just under 9 GBs for the total install.

  1. Download the ISO image of Windows 10 Pro from the Official Microsoft site.

  2. Download Rufus and familiarize yourself with the program.

  3. Open the Windows 10 ISO file using Windows Explorer.

  4. Go to the \Sources directory, and copy out the "install.wim" or "install.esd" file to the C:\mount directory. If you do not have this directory, create it. Rename the .wim or .esd to .wim.bak or .esd.bak.

  5. Mount the Win 10 ISO to a USB stick using Rufus, making sure you use the GPT schema for UEFI.

  6. Install Win 10 from USB to a test PC (not a VM). When you come to the first user-configuration screen (normally Cortana), hit CTRL + SHIFT + F3 to enter Windows 10 Audit Mode. The PC will reboot a time or two, but then it will log you into the Windows hidden Administrator account.

  7. Install all the apps you want / need, including MS Office, Adobe Acrobat / Reader, Chrome, FireFox, etc., but do not activate any of them, and do not activate Windows. Sysprep kills activations (it also kills drivers, so make sure you include all the drivers you need in a C:#Installs folder. Example: We have Dell OptiPlex 5260 AIO's, so I downloaded all the drivers to my C:#Installs\OptiPlex 5260\ directory.).

  8. Run all your Windows Updates. Once they are done, configure all your privacy settings, turn off the gaming, Cortana, consumer experience, etc.

  9. Run your Windows cleanup scripts / uninstall all the garbage that M$ is jamming up the Start Menu with (Candy Crush, etc). Run Disk Cleanup on the C:\ drive, run CCleaner, etc. This will ensure the smallest footprint for the WIM file you will be creating shotly.

  10. Copy your prepared Unattend.xml file to the C:\Windows\Panther directory.

  11. Open an elevated Command Prompt from C:\Windows\System32\cmd.exe and type the following: Sysprep.exe /generalize /oobe /shutdown /unattend:C:\Windows\Panther\UNATTEND.xml

  12. The PC will shutdown; remove your Windows 10 ISO USB stick you booted off of and replace it with your Windows PE USB. Also plug in your 64 GB USB drive, so you can capture a WIM image of Windows 10.

    • If you are not familiar with WinPE, or how to create a working WinPE stick, check out the following tutorial: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/winpe-adding-powershell-support-to-windows-pe.
  13. Start the test PC and boot to the WinPE USB. You will be at the X:\ terminal (a basic command prompt-type program), where you will type DISK PART and hit Enter.

  14. Once you are in Disk Part, perform the following commands: list disk and list vol. Make note of the info in there. SDA0 will be your HDD, SDA1 will be your USB, SDA2 will be your other USB drive. Make note of which SDA is which, and which volumes have which letters. If the volumes do not have letters, assign them accordingly.

  15. Exit Disk Part by typing EXIT and you will be back to the X:\ terminal. Once back there, type the following: dism /capture-image /imagefile:D:\install.wim /capturedir:C:\ /Name:"Win10v1803" /Description:"Win10v1803" /bootable

  16. Replace C:\ and D:\ with your own drive letters, where D:\ is your 64 GB USB stick and C:\ is the Windows C:\ drive. Sometimes my USBs will be marked as F:\ and W:\, etc., so make sure you are pointing DISK to the correct volumes / partitions / disks.

  17. The WIM file capture and recreation process is now underway, and it will take about 45 minutes to an hour (on average) to capture the image.

  18. Once the WIM image is done being captured, it will say something like this:

Deployment Image Servicing and Management tool Version: 10.0.17134.1

Saving image [==========================100.0%==========================] The operation completed successfully.

X:\windows\system32>

  1. At the X:\ terminal after the image is captured, type WPEUTIL SHUTDOWN and the PC will shutdown. Remove the two USB drives, putting the WinPE one to the side and taking the 64 GB over to your tech PC, along with your Windows 10 Install USB -- Plug them both in, and take a look at how big the newly captured WIM file is (mine are normally between 10 and 15 GBs, depending on how many programs and updates I have installed, as well as how many drivers I have set aside for later).

  2. Move the newly created WIM file to your C:\mount directory, you may need it later. Once the WIM file is in the C:\mount, copy the file once more to the Windows 10 Install USB drive's \sources directory, over writing the original file in there.

  3. Once the new WIM file is copied to the Win 10 Install USB, you can use that USB to install a custom Windows image to any PC you want.

    • If you have a program like UltraISO, you can resave the original ISO with the new WIM file in there, which will allow you to mount the custom image to multiple USB drives, and which will allow you to install the custom image to many different form factors and models of PCs.

    • If you will be using ImageX, GImageX, WImageX, etc., then do not worry about recompiling an ISO for later use. I prefer recompiling the ISO, however. It allows me to have multiple ISOs for multiple ORGs within our company.

Hope this helps, it took me months to get to be able to explain this so simply and to perform these actions myself. Anything I can do to help people is exactly what I wanted for myself months ago -- an easy walk through...too bad I didn't find one...lol

Tags:

Iso Image