Modify a Windows ISO and add custom files/folders using mkisofs or genisoimage.
I am sharing the process that I followed while trying to build
ISO files with an updated Autounattend.xml file that contains Server specific
attributes like Hostname, IP Address, Subnet Mask, Administrator Password and some
other custom commands.
On Linux
- Mount the Original Windows Server 2016/2019 ISO Image to a directory named /mnt/iso/win2016 with loopback option on Linux machine.
mount -o loop
<image>.iso /mnt/iso/win2016
- Copy the content from mounted iso image to a new directory named custom_iso:
cp -R /mnt/iso/win2016
/win/2016/custom_iso
- After you update/modify the autounattend.xml file with necessary values for new server, copy it to the toot directory which contains copied data from the ISO (/win/2016/custom_iso in this case).
cp autounattend.xml /win/2016/custom_iso
- Burn the iso image with following parameters using genisoimage:
genisoimage
-bboot/etfsboot.com -no-emul-boot -boot-load-seg 1984 -boot-load-size 8
-iso-level 2 -J -l -D -N -joliet-long -allow-limited-size -relaxed-filenames -V
"WIN_SRV_STD_2016" -o /win/Windows_Server2016_custom.iso /win/2016/custom_iso
Here are the details about different parameters used in above command which are relevant to us.
Parameter/Flag
|
Description
|
genisoimage
|
Command
|
-bboot/etfsboot.com
|
Boot
Sector File
|
-no-emul-boot
|
Options
necessary to build a bootable ISO
|
-boot-load-seg 1984
|
|
-boot-load-size 8
|
|
-iso-level 2
|
|
-J
|
|
-l
|
|
-D
|
|
-N
|
|
-joliet-long
|
|
-allow-limited-size
|
|
-relaxed-filenames
|
|
-V "WIN_SRV_STD_2016"
|
Volume
Label of the ISO
|
-o
/win/Windows_Server2016_custom.iso
|
Final
ISO Name
|
/win/2016/custom_iso
|
Source
Dir with modified/updated files/folders
|
- Burn the iso image with following parameters using mkisofs
mkisofs
-bboot/etfsboot.com -no-emul-boot -boot-load-seg 1984 -boot-load-size 8
-iso-level 2 -J -l -D -N -joliet-long -allow-limited-size -relaxed-filenames -V
"WINSP" -o /win/custom_iso/MKISOFS_2016.iso .
Here are the details
about different parameters used in above command which are relevant to us.
Parameter/Flag
|
Description
|
mkisofs
|
Command
|
-bboot/etfsboot.com
|
Boot Sector File
|
-no-emul-boot
|
Options
necessary to build a bootable ISO
|
-boot-load-seg 1984
|
|
-boot-load-size 8
|
|
-iso-level 2
|
|
-J
|
|
-l
|
|
-D
|
|
-N
|
|
-joliet-long
|
|
-allow-limited-size
|
|
-relaxed-filenames
|
|
-V "WINSP"
|
Volume Label of the ISO
|
-o /win/custom_iso/MKISOFS_2016.iso
|
Final Output ISO
|
.
|
Source Dir with modified/updated
files/folders
|
Please note that genisoimage command is part of the Dell Repository
manager for Windows so if you have Dell Repository Manager for Windows installed
on any Windows server then you should be able to use this on a windows machine too
with slight modifications in the command syntaxes mentioned above.