Go to ...

RSS Feed

Clean install Windows 10 – The Easy Way


Clean installing Windows can be time consuming. Windows Setup, the first phase, has remained about the same since Windows Vista. However, OOBE seems to get new “select that, click this” dialogs in version after version. In corporate IT, we have a myriad of tools to automate deployment, but for private users it can be quite annoying to go through OOBE from accepting the end user license agreement (EULA) and creating a user account, to going through several pages asking about all kinds of (sometimes inane) administrivia.

In this post I will show how you can take just a few minutes to prepare your install media, and completely bypass OOBE to make clean install a piece of cake.

Part 1.) The Answer File

Download the answer file unattend.xml from my OneDrive. You can also see the complete file in the OneDrive text editor, with line numbers.

When downloaded, unblock the file first, then open it in Notepad or any other text / code editor. Change the following lines according to your needs:
– Line 4: ProcessorArchitecture, amd64 for 64-bit Windows, x86 for 32-bit
– Line 5: Default input language (keyboard)
– Lines 6 to 9: Location of PC, OS language
– Lines 28 & 30: Name of local admin account
– Lines 34 & 35: Optional, as you’d prefer
– Line 36: Optional, replaces default time zone
– Lines 41 to 48: Optional, remove if not required
– Line 49: Optional, remove if not required
– Lines 51 to 53: Optional, remove if not required
– Line 54: Same as Line 36

For language settings (lines 5 to 9), see Default Input Profiles (Input Locales) in Windows | Microsoft Docs. For time zones (lines 36 & 54), see Microsoft Time Zone Index Values | Microsoft Docs

Save the file after you have edited it. Do not change its name, it must be unattend.xml

Part 2.) Prepare ESD based USB install media

Notice please: If you have WIM based USB install media, jump directly to Part 3.) Add Answer File to WIM image.

If you have created your Windows 10 install USB flash drive using the Windows Media Creation Tool, it contains the Windows image in an install.esd file rather than in install.wim. The ESD image needs to be converted to WIM before we can mount it for servicing.

Plug in the USB flash drive containing the Windows install files. Run the following command in an elevated Command Prompt to find the index number for the Windows edition you want to install. In my case here, the USB is drive K:, replace the drive letter as required for your system:

dism /Get-WimInfo /WimFile:K:\Sources\install.esd

I will use the Pro edition, with index number 6. I will extract it to a new install.wim file which I will save at the root of drive F:, naming it Windows 10 x64 PRO version 1903 using the following command (#1 in next screenshot):

Dism /Export-Image /SourceImageFile:K:\Sources\install.esd /SourceIndex:6 /DestinationImageFile:F:\install.wim /DestinationName:"Windows 10 x64 PRO version 1903"

Checking the exported WIM file (#2), I can see it now has index 1 and name as I wanted (#3). Now I can copy the new WIM file back to Sources folder on the USB media using the following command (#4):

copy F:\install.wim K:\Sources\

Last, I must delete the original ESD file, to force Windows Setup to use the WIM file instead. I delete the ESD file using the following command (#5):

del K:\Sources\install.esd

Part 3.) Add Answer File to WIM image

Create a new folder, name it Mount. In my case here, I created it at the root of the C: drive. Plug in your USB install media. Just to be sure you mount the correct edition, check the indexes on USB flash drive (K: in this example) using the following command in an elevated Command Prompt:

dism /Get-WimInfo /WimFile:K:\Sources\install.wim

In this example case, I select the Pro edition, index 1, and mount it using the following command in folder C:\Mount (#1 in next screenshot):

dism /Mount-Image /ImageFile:K:\Sources\install.wim /Index:1 /MountDir:C:\Mount

When mounted, I need to create a new folder called Panther in C:\Mount\Windows folder using the following command (#2):

md C:\Mount\Windows\Panther

Now, copy the answer file you downloaded and edited in Part 1 to the Panther folder using the following command (#3). In my case, this file was saved into my Downloads folder:

copy E:\Users\Kari\Downloads\unattend.xml C:\Mount\Windows\Panther\

All done, so it’s time to commit (save) the modified WIM file using the following command (#4):

dism /Unmount-Image /MountDir:C:\Mount /Commit

All done! I needed about 4 minutes to work through the preceding steps. You can now boot a PC from this USB flash drive, run Windows Setup, select the edition you modified, partition the disk as you’d prefer and start installation. From there on forward, everything will be automated. OOBE won’t ask a single question!

Kari

Author: Kari Finn

A former 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.

One Response “Clean install Windows 10 – The Easy Way”

  1. July 8, 2019 at 17:36

    Now for a way to automate this whole procedure to the .ISO / UFD is ready to go at a moment’s notice in case I hose a regular use machine.

Leave a Reply