Overview
Modern Windows operating system deployment typically depends on network and server infrastructure services like Microsoft Endpoint Configuration Manager (formerly known as SCCM).
What if you need to deploy in an environment that does not have these tools?
This article details the process for customizing the Windows installer ISO to incorporate an answer file, allowing you to consistently deploy the operating system without network and server resources. This process should work well for Windows 10 or 11.
Prerequisite Set Up
Software Environment
Download and install the latest Microsoft Assessment and Deployment Kit. Select the Deployment Tools feature during installation. This kit provides the Windows System Image Manager (“SIM”); and Deployment and Imaging Tools Environment (including dism.exe
and oscdimg.exe
) tools required for this process.
Working Directories
Create the following directory structure. You may choose a different location (such as your user profile), but avoid using a directory path that includes spaces.
Directory | Description |
---|---|
C:\Imaging | Parent directory for all Imaging assets |
C:\Imaging\Drivers | Location for storing 3rd party drivers |
C:\Imaging\DVD | Location for storing the contents of the Microsoft Windows DVD ISO |
C:\Imaging\ISO | Output location for customized ISOs |
C:\Imaging\Media | Location for storing logo.png , icon.png , and wallpaper.png referenced in the answer file |
C:\Imaging\Mount | Location for mounting WIM files |
C:\Imaging\WIM | Location for storing WIM and associated catalog file |
Obtain Windows Installer Media
- See Create installation media for Windows to obtain a Windows ISO.
- Double-click (mount) the ISO and copy the contents to
C:\Imaging\DVD\
. - Eject (unmount) the DVD ISO.
- Move
C:\DVD\sources\install.wim
toC:\Imaging\WIM\
.
Obtain 3rd Party Drivers
Obtain any drivers you wish to preload and extract them to individual subdirectories of C:\Imaging\Drivers\
. You can use 7-Zip to extract drivers from CAB files.
Create a List of Undesired Appx Packages (optional)
Windows includes a handful of preloaded Appx packages that you may wish to remove to suit your environment. Use the following PowerShell command to list all installed Appx packages. Make a list of any you wish to remove. These will be referred to as [APPX]
in future steps.
- Open a PowerShell as Administrator and use Dism to determine the index number of your intended edition:
Dism /Get-WimInfo /WimFile:"C:\Imaging\WIM\install.wim"
- Use this Index number to mount the WIM:
Dism /Mount-Image /ImageFile:"C:\Imaging\WIM\22H2\install.wim" /Index:6 /MountDir:"C:\Imaging\Mount"
- Enumerate the AppX Packages and make a list of packages to remove:
(Get-AppxProvisionedPackage -Path C:\Imaging\Mount\).DisplayName
- Unmount the WIM:
Dism /Unmount-Image /MountDir:"C:\Imaging\Mount" /Discard
Create a Catalog and Answer File
Answer files are a complicated topic worthy of their own article. Use this and Microsoft’s guidance on Answer files to decide which components and features will suit your needs.
- Open Windows SIM as Administrator.
File > Select Windows Image > C:\Imaging\WIM\install.wim
- Choose your desired edition e.g., Home, Pro, Enterprise, etc.
- Click Yes to create a catalog.
File > New Answer File > C:\Imaging\DVD\Autounattend.xml
- Populate your answer file as desired.
- Save and close the answer file, windows image, and Windows SIM.
Determine the Edition Index
- Open the Deployment and Imaging Tools Environment as Administrator.
- Execute
Dism /Get-WimInfo /WimFile:"C:\Imaging\WIM\install.wim"
- Find your edition and note the Index number. This will be referred to as
[INDEX]
in the next steps.
Procedure
Open the Deployment and Imaging Tools Environment as Administrator for the following steps.
Export the Edition
In this step, we export the desired [INDEX]
from install.wim
to a new WIM.
> Dism /Export-Image /SourceImageFile:"C:\Imaging\WIM\install.wim" /SourceIndex:[INDEX] /DestinationImageFile:"C:\Imaging\DVD\sources\install.wim"
Mount the Image
In this step, we mount the newly exported WIM. This new WIM contains only the exported edition, so the index will now be “1”.
> Dism /Mount-Image /ImageFile:"C:\Imaging\DVD\sources\install.wim" /Index:1 /MountDir:"C:\Imaging\Mount"
Add Drivers
Here we add drivers to the WIM. This command is recursive so be sure your C:\Imaging\Drivers
directory contains only the desired drivers.
> Dism /Add-Driver /Image:"C:\Imaging\Mount" /Driver:"C:\Imaging\Drivers" /recurse
Copy Media Assets (optional)
If your answer file references any OEM media for e.g., custom logos or wallpaper, they will be copied in this step.
> md "C:\Imaging\Mount\Windows\System32\OEM" > copy "C:\Imaging\Media\*.*" "C:\Imaging\Mount\Windows\System32\OEM\"
Remove Undesired Appx Packages
Refer to your list of undesired Appx packages created above. Run this command once for each package you wish to remove, substituting the full package name for [APPX]
. You may consider scripting this step as described in Removing AppX Packages with PowerShell.
> Remove-AppxProvisionedPackages -Path "C:\Imaging\Mount" -PackageName [APPX]
Unmount the Image
Dism /Unmount-Image /MountDir:"C:\Imaging\Mount" /Commit
Create Custom ISO
> oscdimg.exe -u2 -udfver102 -t -lCustom-Windows -bC:\Imaging\DVD\efi\microsoft\boot\efisys.bin C:\Imaging\DVD\ C:\Imaging\ISO\Custom-Windows.iso
Here’s a breakdown of this command:
Argument | Description |
---|---|
-u2 | Produces an image containing only the UDF file system |
-udfver102 | Writes UDF revision 1.02 |
-t | Specifies the El Torito load segment |
-lCustom-Windows | Specifies the volume label |
-bC:\Imaging\DVD\efi\microsoft\boot\efisys.bin | Specifies the path to the file that will be written to the boot sector |
C:\Imaging\DVD | Path containing the source files |
C:\Imaging\ISO\Custom-Windows.iso | Output location for ISO file |
Conclusion
Now you should have C:\Imaging\ISO\Custom-Windows.iso
that you can write to DVD or to USB media using Rufus or balenaEtcher. Depending on the information you included in your answer file, you may have created a hands-free way to deploy your desired Windows configuration.
- Share:
One thought on “Customizing the Windows Installer Media”
Comments are closed.