Active Directory Lab: Customize the Windows Installer ISOs

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.

Customize the Windows Installer ISOs

Assumptions

  • Windows is installed to the C drive.
  • The ozo-ad-lab Git repository has been cloned to C:\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

  1. 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\"
  2. Eject the ISO.
  3. 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\"
  4. Enumerate the editions contained in the WIM.
    Get-WindowsImage -Path "C:\ozo-ad-lab\WIM\Windows Server 2022\install.wim"
  5. 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"
  6. In C:\ozo-ad-lab\Builds\DC, modify Autounattend.xml and AD Lab\ as needed.
  7. 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

  1. 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\"
  2. Eject the ISO.
  3. If you have already performed the above DC steps, skip to step 6.
  4. 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\"
  5. Enumerate the editions contained in the WIM.
    Get-WindowsImage -Path "C:\ozo-ad-lab\WIM\Windows Server 2022\install.wim"
  6. 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"
  7. In C:\ozo-ad-lab\Builds\Server, modify Autounattend.xmlAD Lab\, and Share\ as needed.
  8. 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

  1. 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\"
  2. Eject the ISO.
  3. 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\"
  4. Enumerate the editions contained in the WIM.
    Get-WindowsImage -Path "C:\ozo-ad-lab\WIM\Windows 11 Enterprise\install.wim"
  5. 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"
  6. 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"
  7. Double-click to mount the Windows 11 Language and Optional Features ISO.
  8. 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
  9. Dismount the WIM, saving changes.
    Dismount-WindowsImage -Path "C:\ozo-ad-lab\Mount"
  10. In C:\ozo-ad-lab\Builds\Client, modify Autounattend.xml as needed.
  11. 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


Customize the Windows Installer ISOs