Overview
This is the fifth post in a multi-part series that illustrates how to customize the Windows installer media to automate the process of installing a Windows AD domain controller, a Windows file server, and a Windows desktop environment. This article details the process for customizing the Windows installer ISOs to automate the Windows installation.
- Introduction
- Architecture
- Prerequisites
- Create the Virtual Machines
- Customize the Windows installer ISOs
- Install the Linux Router
- Install the Windows Systems
- Conclusion
Customize the Windows Installer ISOs
Assumptions
- Windows is installed to the
C
drive. - The
ozo-ad-lab
Git repository has been cloned toC:\ozo-ad-lab
. - Microsoft Windows evaluation edition ISOs are downloaded to
C:\ozo-ad-lab\ISO
and renamed as described in Prerequisites.
Automated Method
PENDING Execute the ISO Customization Script
This script brings together the downloaded installer ISOs, answer files, and scripts; and builds three custom Windows installers. In an Administrator PowerShell:
Set-Location "C:\ozo-ad-lab"
.\ozo-ad-lab.ps1 -GitDir "C:\ozo-ad-lab"-ServerISO "C:\ozo-ad-lab\ISO\Microsoft-Windows-Server-2022-Evaluation.iso" -ClientISO "C:\ozo-ad-lab\ISO\Microsoft-Windows-11-Enterprise-Evaluation.iso"
Once the process is complete, you will find three ISO files in C:\ozo-ad-lab\ISO
:
AD-Lab-DC.iso
AD-Lab-Server.iso
AD-Lab-Client.iso
Manual Method
Create the DC ISO
- Double-click to mount the Windows Server 2022 ISO and copy the contents to the DC folder.
Copy-Item -Recurse -Path "D:\*" -Destination "C:\ozo-ad-lab\Builds\DC\"
- Eject the ISO.
- Move the install WIM to the WIM folder.
Move-Item -Path "C:\ozo-ad-lab\Builds\DC\sources\install.wim" -Destination "C:\ozo-ad-lab\WIM\Windows Server 2022\"
- Enumerate the editions contained in the WIM.
Get-WindowsImage -Path "C:\ozo-ad-lab\WIM\Windows Server 2022\install.wim"
- Export the desired Index back to the Build folder (for example for Index 2, Windows Server 2022 Standard).
Export-WindowsImage -SourceImagePath "C:\ozo-ad-lab\WIM\Windows Server 2022\install.wim" -SourceIndex 2 -DestinationImagePath "C:\ozo-ad-lab\Builds\DC\sources\install.wim"
- In
C:\ozo-ad-lab\Builds\DC
, modifyAutounattend.xml
andAD Lab\
as needed. - Create the new ISO.
& "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\oscdimg.exe" -u2 -udfver102 -t -lAD-Lab-DC -bC:\ozo-ad-lab\Builds\DC\efi\microsoft\boot\efisys.bin C:\ozo-ad-lab\Builds\DC C:\ozo-ad-lab\ISO\AD-Lab-DC.iso
Create the Server ISO
- Double-click to mount the Windows Server 2022 ISO and copy the contents to the Server folder.
Copy-Item -Recurse -Path "D:\*" -Destination "C:\ozo-ad-lab\Builds\Server\"
- Eject the ISO.
- If you have already performed the above DC steps, skip to step 6.
- Move the install WIM to the WIM folder.
Move-Item -Path "C:\ozo-ad-lab\Builds\Server\sources\install.wim" -Destination "C:\ozo-ad-lab\WIM\Windows Server 2022\"
- Enumerate the editions contained in the WIM.
Get-WindowsImage -Path "C:\ozo-ad-lab\WIM\Windows Server 2022\install.wim"
- Export the desired Index back to the Build folder (for example for Index 2, Windows Server 2022 Standard).
Export-WindowsImage -SourceImagePath "C:\ozo-ad-lab\WIM\Windows Server 2022\install.wim" -SourceIndex 2 -DestinationImagePath "C:\ozo-ad-lab\Builds\Server\sources\install.wim"
- In
C:\ozo-ad-lab\Builds\Server
, modifyAutounattend.xml
,AD Lab\
, andShare\
as needed. - Create the new ISO.
& "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\oscdimg.exe" -u2 -udfver102 -t -lAD-Lab-Server -bC:\ozo-ad-lab\Builds\Server\efi\microsoft\boot\efisys.bin C:\ozo-ad-lab\Builds\Server C:\ozo-ad-lab\ISO\AD-Lab-Server.iso
Create the Client ISO
- Double-click to mount the Windows 11 Enterprise ISO and copy the contents to the Client folder.
Copy-Item -Recurse -Path "D:\*" -Destination "C:\ozo-ad-lab\Builds\Client\"
- Eject the ISO.
- Move the install WIM to the WIM folder.
Move-Item -Path "C:\ozo-ad-lab\Builds\Client\sources\install.wim" -Destination "C:\ozo-ad-lab\WIM\Windows Server 2022\"
- Enumerate the editions contained in the WIM.
Get-WindowsImage -Path "C:\ozo-ad-lab\WIM\Windows 11 Enterprise\install.wim"
- Export the desired Index back to the Build folder (for example for Index 1, Windows 11 Enterprise).
Export-WindowsImage -SourceImagePath "C:\ozo-ad-lab\WIM\Windows 11 Enterprise\install.wim" -SourceIndex 1 -DestinationImagePath "C:\ozo-ad-lab\Builds\Client\sources\install.wim"
- Mount the install WIM (now using Index 1 because this exported WIM contains only one edition).
Mount-WindowsImage -ImagePath "C:\ozo-ad-lab\Builds\Client\sources\install.wim" -Index 1 -Path "C:\ozo-ad-lab\Mount"
- Double-click to mount the Windows 11 Language and Optional Features ISO.
- Install the RSAT tools to the WIM.
Get-WindowsCapability -Name "RSAT*" -Online -Source D:\LanguagesAndOptionalFeatures | Add-WindowsCapability Path C:\ozo-ad-lab\Mount -Source D:\LanguagesAndOptionalFeatures
- Dismount the WIM, saving changes.
Dismount-WindowsImage -Path "C:\ozo-ad-lab\Mount"
- In
C:\ozo-ad-lab\Builds\Client
, modifyAutounattend.xml
as needed. - Create the new ISO.
& "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\oscdimg.exe" -u2 -udfver102 -t -lAD-Lab-Client -bC:\ozo-ad-lab\Builds\Client\efi\microsoft\boot\efisys.bin C:\ozo-ad-lab\Builds\Client C:\ozo-ad-lab\ISO\AD-Lab-Client.iso
Move the ISOs
Move all AD-Lab-*
ISOs from C:\ozo-ad-lab\ISO
to your Downloads folder.
Related Posts
Previous: Create the Virtual Machines
Customize the Windows Installer ISOs
Next: Install the Linux Router