Back to Basics – Implementing an Image Factory

Last week I was participating in a thread on Twitter regarding a request for Microsoft to generate monthly updated media (ISO files) for all supported Windows versions. Something that Microsoft certainly can do, and probably do internally, but for whatever reason have decided to only publish for the very latest versions of Windows. Because of this decision, organizations are forced to implement routines for this themselves. The concept of generating media in-house in an automated fashion is often called having an Image Factory.

In this post you learn to set up an Image Factory solution for both thin and thick images. In the example I'm generating updated media for Windows Server 2019, but the same steps work for Windows 10/11, and Windows Server 2016/2019/2022.

Image Strategy

Deploying Windows from already updated media is more critical than you may think: First of all, if the media is already updated, it will not leave the system vulnerable until it can be patched by either the deployment process, or later updates. Second, when using media for Windows 10 or Windows 11 servicing – Inplace upgrades – an updated media will reduce servicing failures.

For installation media, or images, there are two types:

  • Thick images. An image that includes one or more applications.
  • Thin (default) images. An image that contains only Windows.

Since thin images are the more common image type, you'll learn about that first.

Using an Image Factory for creating Thin Images

Thin images can be used for all deployment scenarios that Windows Client and Windows Server supports and are typically serviced offline. Servicing an image online via Sysprep and Capture would break the upgrade scenarios, so don't do that for thin images. In its simplest form a thin image can be serviced by downloading an older ISO of the Windows version you want to service and run a few dism.exe commands to add updates to it. But you typically want something more automated like the OSDBuilder solution from David Segura. This PowerShell module makes it very easy to update any media up to the latest version.

Windows Server 2019 LTSC ISO from August 2021.

Here is an example for updating an older ISO with Windows Server 2019 LTSC to an updated folder structure (and optionally a new ISO file or VHDX file). The older ISO source is named Windows Server 2019 (updated August 2021).iso and in the image above you can see I copied it to the C:\ISO folder.

Note: If you want to update multiple medias quickly, I recommend spreading the workload via remote PowerShell to multiple hosts, or multiple virtual machines. A single media update, even though fully automated, can easily take 45-60 minutes depending on your hardware.

Sample script: Creating an updated Windows Server 2019 media:

# Sample Script for using OSDBuilder to create an updated media of Windows Server 2019 LTSC.
# Note 1: When not doing any customizations there is no need to create an OSBuild, updating the OSMedia is enough.
# Note 2: Even though OSDBuilder installs the OSD module, I recommend installing the OSD first to force an update.

# Define media and Windows edition to work with
$ISO = "C:\ISO\Windows Server 2019 (updated August 2021).iso"
$Edition = "Windows Server 2019 Standard (Desktop Experience)"

# Install and Import OSDBuilder Modules
Install-Module -Name OSD -Force
Install-Module -Name OSDBuilder -Force
Import-Module -Name OSDBuilder 

# Mount the Operating System ISO
Mount-DiskImage -ImagePath $ISO

# Import and update the media 
# Note: The -Update switch for Import-OSMedia automatically calls Update-OSMedia with the -Download -Execute -HideCleanupProgress options
Import-OSMedia -ImageName $Edition -SkipGrid -Update

Optional Commands #1: Creating ISO or VHDX Files from the updated media

# Generate a new ISO file from the updated media
Get-OSMedia | Where-Object Name -like 'Windows Server 2019 Standard*' | Where-Object MediaType -eq 'OSMedia' | foreach { New-OSDBuilderISO -FullName $_.FullName }

# Apply the OS to a VHDX file 
Get-OSMedia | Where-Object Name -like 'Windows Server 2019 Standard*' | Where-Object MediaType -eq 'OSMedia' | foreach { New-OSDBuilderVHD -FullName $_.FullName -VHDSizeGB 100 }
The updated ISO file
The updated VHDX file

Optional Commands #2: Check for updates

# Check for updated OSDBuilder module

# Update OSDBuilder to latest version
OSDBuilder -UpdateModule

# List updates for an OS
Get-DownOSDBuilder -GridView -UpdateOS 'Windows Server' -UpdateBuild 1607

VHDX Bonus: If you want more disk options when applying the OS to VHDX file, you can use the Convert-WindowsImage.ps1 fork instead: Here is an example:

Note: If using this script, I recommend increasing the EFI system partition to at least 200 MB. By default the script sets it to 100 MB (on line 4162).

$Media = Get-OSMedia | Where-Object Name -like 'Windows Server 2019 Standard*' | Where-Object MediaType -eq 'OSMedia'
$WimFile = "$($Media.FullName)\OS\sources\install.wim"
$Edition = "Windows Server 2019 Standard (Desktop Experience)"
$OutPutVHDXPath = "C:\VHDs"
$OutPutVHDXFile = "$OutPutVHDXPath\WS2019Standard.vhdx"

# Create UEFI-based VHDX file
New-Item -Path $OutPutVHDXPath -ItemType Directory -Force
C:\Scripts\Convert-WindowsImage.ps1 -SourcePath $WimFile -Edition $Edition -VHDPath $OutPutVHDXFile -VHDFormat VHDX -VHDType Dynamic -VHDPartitionStyle GPT -SizeBytes 100GB

Using an Image Factory for creating Thick Images

Thick images are commonly used in education environment where admins need to deploy a lab room quickly, but there are other uses as well. For thick images I recommend combining MDT with an Image Factory module for MDT written by Mikael Nystrom.

To build an Image Factory solution for thick images, follow these two guides:

Happy Deployment / Johan

About the author

Johan Arwidmark

5 2 votes
Article Rating
Notify of
Oldest Most Voted
Inline Feedbacks
View all comments
Gareth Chapman
Gareth Chapman
1 year ago

Johan would you use WIMWitch ?