Go to ...

RSS Feed

Windows 10 Unattended install media – Part 5: Sysprep & Capture Image

Final phase of this project is to sysprep customized Windows image, capture it to a WIM file, and create an ISO for completely automated installation.

Create a Checkpoint

On your reference Hyper-V VM, create a checkpoint before proceeding. Select Action > Checkpoint in Virtual Machine Connection window, name the checkpoint as you wish, click YES to save it:

Later when you Sysprep or capture the image, if something goes wrong, it simply does not work, or if the system presents an error message, you can restore the state of reference VM as it was when checkpointed. This process takes less than a minute, after which you can troubleshoot / fix the errors, and try again. Consider it a form of cheap and fast insurance, because that’s exactly how it works.


On the reference VM, browse to the C:\Windows\System32\Sysprep folder, run Sysprep.exe. Select System Cleanup Action > Enter System Out-of-Box Experience (OOBE), select Generalize, select Shutdown Options > Shutdown, then click OK to start Sysprep:

Sysprep will run and generalize the Windows image (make it hardware independent). Windows on the reference VM will be shut down when Sysprep is complete:

Depending on the size of the Windows image (installed software, customizations etc.), this can take anywhere from a very few minutes to as long as 10-15 minutes (seldom longer, but for a huge complex Windows installation that’s at least possible).

Capture the custom Windows image

Open Disk Management on your host machine. Attach the reference VM’s VHDX file (virtual hard disk):

Attach the VHDX (virtual hard disk file) from your reference VM to the host. In case you have made one or more checkpoints, when deciding which VHDX to attach, select All files and attach the last checkpoint file (checkpoint file extension is .avhdx). Check the file’s Date Modified timestamp to be sure you attach the most recent checkpoint created:

Set the VHDX or AVHDX file as read only:

File Explorer will automatically open the attached VHDX or AVHDX (checkpoint). Note the drive letter it gets. In my case, it got drive letter I:

On the host machine, open an elevated (Run as administrator) Command Prompt. Enter the following command, changing the path in /ImageFile: to wherever you’d like to save the captured install.wim file, and set /CaptureDir to the drive letter for your attached (mounted) VHDX or AVHDX file. Name it as you like (/Name:”AnyName”):

dism /Capture-Image /ImageFile:H:\Capture\install.wim /CaptureDir:I:\ /name:"W10PRO" /compress:maximum /checkintegrity /verify /bootable

Click to view enlarged in a new tab.

In case you used a physical PC as your reference machine instead of a Hyper-V VM, see this support article on Microsoft Docs about how to capture a Windows image from such a machine: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/capture-images-of-hard-disk-partitions-using-dism

Be patient. Capturing an image is a resource eating process, on slower hardware it can take several minutes even for the progress bar to appear and start from 0%. On this laptop of mine, the whole capturing process takes about half an hour, progress bar appears first in about 10 minutes. On the other hand, on a fast i7 machine with an SSD, the whole process is done in couple of minutes.

Make ISO

Create a folder anywhere on your host, and name it ISO_Files (that’s the name I use, you can of course name the folder as you wish). Mount the Windows 10 ISO image you used to install Windows onto the reference machine as a virtual DVD drive (right click ISO > select Mount). In File Explorer, select the mounted ISO, copy its entire contents to the ISO_files folder.

Now, copy the autounattend.xml answer file you created in Part 2 to the root of the ISO_Files folder. Open the ISO_Files\Sources folder, and delete the  install.wim file. Copy your custom install.wim file captured above into the same folder, thereby replacing the original. That’s the new customized image you’ll be installing!

In Part 2, when creating the answer file named autounattend.xml for Windows Setup, we installed the Windows ADK Deployment Tools. Part of those tools is the Windows Deployment and Imaging Tools Environment. Right click it in Start > W > Windows Kits, then select More > Run as administrator:

By default, it has a disturbingly long prompt. Run the command cd \ to jump to the root of C: drive, then enter following command to create your custom ISO:

oscdimg.exe -m -o -u2 -udfver102 -bootdata:2#p0,e,bH:\Iso_Files\boot\etfsboot.com#pEF,e,bH:\Iso_Files\efi\microsoft\boot\efisys.bin H:\ISO_Files D:\AnyName.iso

This line may break across multiple lines in your Web browser. It’s a single command, and a single line of code. Simply triple-click (like double click but click mouse left button rapidly three times in the code box) the command, right click it and select “Copy” to copy the whole thing into your paste buffer so you can paste it into Deployment and Imaging Tools Environment.

Here’s a screenshot of what this looks like when run in Deployment and Imaging Tools Environment window:

Click to view enlarged in a new tab.

Notice that the OSCDIMG command switches have no spaces or other characters between a switch and its properties.For instance, the path to the boot files appears as bH:\Iso_Files\ (green highlight in the preceding command sample), where b is the switch and H:\ISO_Files\ is its target folder. Name the ISO as you wish with the extension .iso and select where to create and store it (that’s the red highlight in the preceding command sample).

That’s it folks! You have now created Windows install media for a totally automated, hands-free Boot & Forget installation of Windows 10. You can use this ISO as-is to install Windows from a network share, or copy it to a USB flash drive and boot a PC from it to install Windows 10 without any user interaction.

Please do not hesitate to ask any questions about anything covered in this series of stories. Simply post a comment with your questions here, or in any of its other parts (1-4).

Links to all five parts:



Author: Kari Finn

A Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.

6 Responses “Windows 10 Unattended install media – Part 5: Sysprep & Capture Image”

  1. May 31, 2018 at 05:36

    naturally like your website but you have to check the spelling on several of your posts. Many of them are rife with spelling problems and I find it very bothersome to tell the truth nevertheless I’ll definitely come back again.

  2. Daniel
    June 25, 2018 at 15:13

    I dont really know what you are using the Asset Share for with the setup files or maybe I missed something?
    Where do you say the Process to install these files?

    Thank you very much for the Tutorial!

  3. June 25, 2018 at 16:06

    I am using the Assets share to transfer installers and other files to reference machine.

    While Windows installs on reference machine, I’ll prepare the Assets folder on technician machine sharing it. When reference machine is booted to Audit Mode, I have fast and easy access to various installers, themes and other files on the shared Assets folder.

    It’s much faster and simpler than to download everything needed on reference machine.

  4. dayang333
    June 28, 2018 at 13:11

    Hi, as my understanding,this is the process to create the USB installation media.How about the boot image if we use WDS?

  5. June 28, 2018 at 13:17

    This series of posts does not show how to create a USB install media for unattended install, it shows how to create an ISO image.

    At the end of this Part 5, you will be told how to create a custom ISO image. You can use that for any available deployment method. To create a USB is one option, to use ISO in other deployment scenarios as such is another option.

  6. James
    July 22, 2018 at 20:31

    Kari, Great write-up. I have managed to use this completed custom ISO image to deploy another VM to prove it worked. The only interaction i had before Windows loaded was at the language screen settings where there was no option to change from the default Language to install ;English (United States).

    The ‘time and currency format’ and also ‘keyboard or input method’ settings were displayed as expected as EN-GB which is what i set them to in my answer file. Not sure why the language to install was not this as well though, is that due to the ISO i used? Should i have set the fallback language to EN-US in my answer file so this screen would not be displayed?

    Secondly. It would be great if you did a follow up video on how to deploy this custom image we have created out using WDS (if that is the preferred method these days). When testing, I try to add my custom .WIM file in WDS it says ‘the file does not contain a valid install image’.

    Keen to understand next steps on how we deploy this out to multiple machines via pxe at once to complete this series.

Leave a Reply

This website stores some user agent data. These data are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to opt-out of any future tracking, a cookie will be set up in your browser to remember this choice for one year. I Agree, Deny
%d bloggers like this: