Skip to content

Refactor Win11 Creator ISO workflow - #4862

Merged
ChrisTitusTech merged 12 commits into
ChrisTitusTech:mainfrom
mewclouds:bugfix/win11-creator-iso-workflow
Jul 28, 2026
Merged

Refactor Win11 Creator ISO workflow#4862
ChrisTitusTech merged 12 commits into
ChrisTitusTech:mainfrom
mewclouds:bugfix/win11-creator-iso-workflow

Conversation

@mewclouds

Copy link
Copy Markdown
Contributor

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Refactor
  • UI/UX improvement

Description

This refactors the Win11 Creator ISO flow around the actual failure mode from #4860: the previous workflow performed unnecessary offline DISM servicing on install.wim, including mounting/saving the image and running cleanup such as /ResetBase, even when the generated ISO did not need driver injection.

That made ISO generation depend on the host Windows installation's DISM servicing state. In testing, some hosts could complete the mount/save path without an obvious DISM failure while still leaving the WIM metadata in a bad state. Windows Setup then validates the <ImageInstall> index from autounattend.xml against that damaged metadata and fails before setup can continue.

The important change is that Win11 Creator no longer touches install.wim for the normal no-driver path. For that path, it only copies the ISO contents, writes autounattend.xml, writes the selected-edition ei.cfg, and exports the ISO. That avoids the fragile DISM path entirely and makes ISO generation much faster.

Driver injection still needs offline servicing, but that path is now narrower: it mounts only the selected WIM index, adds exported drivers in one /Add-Driver /Recurse operation, commits once, and validates WIM metadata before and after. It also keeps WinPE staging limited to boot/storage drivers so setup discovery is not overloaded.

I tried a few lighter driver-delivery paths first, but they were less predictable:

  • $OEM$ / .cmd / SetupComplete.cmd delivery can depend on Windows Setup timing and OEM activation behavior. On OEM-key machines, that path is not reliable enough for this workflow.
  • Live/runtime driver injection with pnputil depends on the exported driver folder surviving setup and being discoverable from the installed OS. That failed in testing, including cases where no staged C:\Windows\Drivers INF files were found after install.
  • Putting every exported driver under $WinPEDriver$ makes Windows Setup discover them early, but it can overload setup before the normal setup UI loads. In testing that caused setup to fail immediately.

That leaves two practical paths: avoid DISM entirely when drivers are not requested, and use the smallest possible DISM servicing path when drivers are requested.

I also added fallback staging for the setup scripts under sources\$OEM$\$$\Setup\Scripts. The answer-file extension extraction path still exists, but the generated media no longer depends on that being the only way those scripts reach C:\Windows\Setup\Scripts.

Benchmarks from local testing:

Environment Driver injection Duration First log Last log
Main system No 20s [12:38:11] ISO selected [12:38:31] install.wim modification complete
Main system Yes 9m 17s [12:08:54] ISO selected [12:18:11] install.wim modification complete
Older hardware No 45s [09:52:29] ISO selected [09:53:14] install.wim modification complete
Older hardware Yes 11m 15s [09:55:41] ISO selected [10:06:56] install.wim modification complete

Verification performed:

  • git diff --check
  • .\Compile.ps1
  • Full Pester suite passed
  • Generated no-driver ISO on main system and older hardware.
  • Generated driver-injected ISO on main system and older hardware.
  • Installed and tested generated media in a VM.
  • Installed and tested generated media on a older hardware.
  • Confirmed post-install WinUtil tweaks/AppX customizations ran.
  • Confirmed expected first-logon restart behavior.
  • Confirmed the older hardware install used proper graphics drivers during setup instead of Microsoft Basic Display behavior.
  • Confirmed installed driver inventory included expected exported drivers.
  • Confirmed no unknown devices were present after install.

Issue related to PR

Keep no-driver ISO generation on the fast copy-only path.

Inject exported drivers with one selected-index WIM mount, one Add-Driver pass, and one commit.

Limit WinPE staging to boot-storage drivers and improve workflow validation coverage.
Copy the prepared setup script payloads into sources/$//Setup/Scripts so setup media does not depend solely on answer-file extension extraction.

Keep the existing autounattend execution path unchanged and cover the fallback files in the Win11 Creator tests.
@github-actions github-actions Bot added the bug Something isn't working label Jul 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ccdda4ec91

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread functions/private/Invoke-WinUtilISOScript.ps1 Outdated
Comment thread functions/private/Invoke-WinUtilISOScript.ps1
Comment thread functions/private/Invoke-WinUtilISOScript.ps1
Comment thread functions/private/Invoke-WinUtilISOScript.ps1 Outdated
Rename the ISO logger to Write-WinUtilISOLog so the shared runspace pool imports it automatically. Run Mount & Verify off the WPF thread with dispatcher-safe UI updates, and add Pester coverage for the runspace and logger contract.
@mewclouds

Copy link
Copy Markdown
Contributor Author

@codex review latest changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 919768e18b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread functions/private/Invoke-WinUtilISO.ps1
Comment thread functions/private/Invoke-WinUtilISOScript.ps1 Outdated
Comment thread functions/private/Invoke-WinUtilISO.ps1
Keep the selected ISO stable during background verification. Apply ContentDeliveryManager settings to both the first account and the default profile. Block FAT32 USB creation when install.esd exceeds the supported file size.
@mewclouds

Copy link
Copy Markdown
Contributor Author

@codex review and let me watch the world cup please

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 709ca0826e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread functions/private/Invoke-WinUtilISOScript.ps1
Comment thread functions/private/Invoke-WinUtilISOScript.ps1
Set BypassNRO before OOBE so local account setup is available during Windows Setup.

Detect registered DISM mounts during driver-injection cleanup so partial mount failures are discarded.
@mewclouds

Copy link
Copy Markdown
Contributor Author

@codex review.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f915bb064

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread functions/private/Invoke-WinUtilISOUSB.ps1 Outdated
Comment thread functions/private/Invoke-WinUtilISO.ps1
Comment thread functions/private/Invoke-WinUtilISOScript.ps1
Comment thread functions/private/Invoke-WinUtilISOScript.ps1
Use the actual FAT32 file limit for install.esd USB checks.

Disable ISO modification while mount verification is running.

Apply unsupported-hardware notice suppression to the first user profile.
@mewclouds

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: a473d7f879

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2570ad93b5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread functions/private/Invoke-WinUtilISOScript.ps1
Comment thread functions/private/Invoke-WinUtilISOScript.ps1
Comment thread functions/private/Invoke-WinUtilISOScript.ps1
Set device encryption and reserved-storage registry guards before OOBE.

Enable the OEM configuration-set fallback when setup scripts are staged there.
…uds/winutil into bugfix/win11-creator-iso-workflow
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4a3a4bb1-8517-450a-bf49-6002dd82a5c3

📥 Commits

Reviewing files that changed from the base of the PR and between b2743db and 67e39ba.

📒 Files selected for processing (1)
  • xaml/inputXML.xaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • xaml/inputXML.xaml

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Enhanced Windows 11 installation media customization with first-logon scripts and added hardware-compatibility bypass settings.
    • Updated storage driver injection to stage boot-storage drivers for Setup and apply driver changes to a single DISM servicing pass.
    • Improved progress/status reporting during ISO browsing, mounting, verification, customization, and export.
    • Improved the Step 2 tooltip to reflect the updated driver-injection behavior.
  • Bug Fixes
    • Added stronger installation image metadata validation and safer cleanup when servicing fails.
    • Prevented USB creation when install.esd is oversized, before prompting to erase.

Walkthrough

The Win11 ISO workflow now prepares copied setup media, stages post-install scripts and storage drivers, constrains WIM servicing, validates metadata, adds setup bypass commands, runs UI work asynchronously, and blocks oversized ESD files before USB creation.

Changes

Win11 ISO creator workflow

Layer / File(s) Summary
Setup media and driver servicing
functions/private/Invoke-WinUtilISOScript.ps1, pester/win11creator.Tests.ps1, AGENTS.md, xaml/inputXML.xaml
ISO customization now writes answer-file scripts, stages storage drivers, performs one selected-image driver servicing pass, validates WIM metadata, and tests success and failure paths.
Answer-file setup commands
tools/autounattend.xml, pester/win11creator.Tests.ps1
The answer file adds CPU, storage, OOBE, device-encryption, and reserve-manager registry commands with corresponding assertions.
ISO UI orchestration and export
functions/private/Invoke-WinUtilISO.ps1, pester/win11creator.Tests.ps1
Mount, verification, modification, and export workflows use Write-WinUtilISOLog, run background work through WPF runspaces, prepare copied ISO contents, and stream oscdimg output.
USB preflight and status handling
functions/private/Invoke-WinUtilISOUSB.ps1, pester/win11creator.Tests.ps1
USB discovery and write status messages use the generalized logger, while install.esd files at least 4 GB are rejected before erase confirmation.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ISOUI
  participant InvokeWPFRunspace
  participant InvokeWinUtilISOScript
  participant DISM
  participant Oscdimg
  ISOUI->>InvokeWPFRunspace: start ISO verification
  InvokeWPFRunspace->>InvokeWinUtilISOScript: prepare copied setup media
  InvokeWinUtilISOScript->>DISM: service selected install.wim index
  DISM-->>InvokeWinUtilISOScript: return validation status
  ISOUI->>InvokeWPFRunspace: start ISO export
  InvokeWPFRunspace->>Oscdimg: build ISO and stream process output
Loading

Suggested reviewers: christitustech

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the main change: refactoring the Win11 Creator ISO workflow.
Description check ✅ Passed The description is clearly related to the changeset and explains the refactor and bug fix in detail.
Linked Issues check ✅ Passed The changes address #4860 by removing unnecessary no-driver WIM servicing and narrowing driver injection to a safer offline path.
Out of Scope Changes check ✅ Passed The diff stays focused on the ISO workflow, tests, and related UI/docs updates without obvious unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@functions/private/Invoke-WinUtilISOUSB.ps1`:
- Around line 33-45: Update the install.esd validation near $installEsd so it
runs whenever install.esd exists, independent of whether $installWim is present.
Preserve the existing 4 GB threshold, warning message, and early return so media
containing both files is rejected before USB operations begin.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c309b750-824f-4f47-bfd6-d9c84c7442f4

📥 Commits

Reviewing files that changed from the base of the PR and between 5c104d0 and 36539bf.

📒 Files selected for processing (7)
  • AGENTS.md
  • functions/private/Invoke-WinUtilISO.ps1
  • functions/private/Invoke-WinUtilISOScript.ps1
  • functions/private/Invoke-WinUtilISOUSB.ps1
  • pester/win11creator.Tests.ps1
  • tools/autounattend.xml
  • xaml/inputXML.xaml

Comment thread functions/private/Invoke-WinUtilISOUSB.ps1
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@ChrisTitusTech
ChrisTitusTech merged commit 5ebb24b into ChrisTitusTech:main Jul 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows 11 Setup || Setup has failed to validate the product key || While testing on VMWare or VirtualBox

2 participants