Skip to content

v48 patch 2

Choose a tag to compare

@ArthurJDurand ArthurJDurand released this 06 Oct 19:05
· 35 commits to main since this release

WinRE Manager v48 patch 2

This is the first public release of the v48 line. No v48 patch 1 release was published; v48 patch 2 incorporates all v48 development changes — intervening-partition handling, the architecture gate, the LocalInputsId field, LKG-by-hash at any discovered recovery location, transactional WIM replacement, the WinRE-Manager.cmd wrapper, and the fail-fast elevation guard — together with a set of code-review fixes and hardening changes.

ScriptVersion moves from 47 to 48, so every managed machine performs one full-update pass on its next scheduled run, then returns to the fast path. No manual state-file action is required.

Added

Intervening-partition handling. The C: | D: | Recovery layout is handled automatically: the manager identifies D: as an intervening anchor, validates it (on the OS disk, not C:, not a recovery-typed partition, not EFI/MSR/system/reserved, NTFS, accessible for resize, sufficiently large, shrinkable from the right), shrinks it, and creates a new recovery partition in the freed space. The scope is deliberately narrow — exactly one intervening partition, no partition-moving, no extension of the anchor. Multi-intervening layouts (C: | D: | E: | Recovery) and the surplus case defer stably with named reasons. Motivated by a 2026-10-05 AMD Ryzen 7 5825U field case; the 2026-10-06 field run confirms the path works end-to-end on the exact motivating layout.

Architecture gate. Get-HardwareObject reports the actual OS architecture, normalized to x64, ARM64, x86, or unknown. The manager refuses to run on any architecture other than x64; the refusal is a stable, named deferral that exits EXIT_WARNING before any state mutation. ARM64 support is not claimed.

LocalInputsId. A new state-file field that binds the offline fast-path decision to the three deployment inputs observable without a network fetch: hardware identity, OS build, and CPU vendor/generation. On the offline fallback path the run recomputes the hash and defers with EXIT_WARNING on mismatch rather than trusting a DesiredStateId that describes a machine whose hardware or OS has since changed. Closes the offline hardware-drift residual from v44 patch 5.

LKG-by-hash at any discovered recovery location. Get-LKGWinREImagePath scans every type-coded recovery partition on the OS disk for a winre.wim whose SHA256 matches state.CurrentImageHash, in addition to the canonical C:\Recovery\WindowsRE\winre.wim path. Provenance is content, not pathname.

Transactional WIM replacement. Deploy-WimTransactional replaces the WIM on the active route without a window in which a failure leaves the target with no usable WIM. The existing WIM is preserved as a rollback copy in the workspace before the target is deleted; on any copy failure the rollback copy is restored and hash-verified. Closes the v47 window where Remove-Item $target followed by Copy-Item $SourceWim -Destination $target with no rollback could leave the target with no WIM on a mid-copy failure.

scripts/WinRE-Manager.cmd. A menu-driven interactive wrapper. The launcher runs unelevated and opens the menu in the current console; selecting an action elevates only the target PowerShell script via Start-Process -Verb RunAs, so the wrapper window stays in place and only the .ps1 runs elevated. Options are test harness, DryRun preview, live run, log viewer, and quit. Live runs require typing RUN to confirm.

Fail-fast elevation guard. A new guard runs at the top of the try block, before the program lock, hardware probes, manifest fetch, and workspace allocation. On an unelevated launch it logs FATAL: WinRE Manager requires an elevated (Administrator) PowerShell session. and exits EXIT_FATAL in milliseconds, creating the log directory solely so the FATAL message has somewhere to be written. Motivating evidence: the 2026-10-05 14:28 and 14:45 field runs spent roughly four minutes each progressing through hardware detection, manifest fetch, and the multi-minute GitHub base-WIM download before failing at Mount-WindowsImage with an ambiguous FATAL. Accepts both interactive Administrator sessions and the SYSTEM context used by the scheduled task.

Fixed

Source-WIM hash cache. $cachedSourceHash, $cachedSourceBuild, and $cachedSourceMetadata are captured immediately after $SourceWim is assigned. This closes a reachable path that existed since v47: on the enable-only path, a reagentc /setreimage failure falls through to the full-update path with $needInject = $false, and $SourceWim points at the registered WIM on a recovery partition accessed via a temporary drive letter. That letter is removed before reagentc /enable; the subsequent Get-LiveWimHash $SourceWim returned $null, the state file was not written, and the next scheduled run repeated the full-update pass.

Extension-failure fallback: post-delete verification resynchronised with the mutated plan. When the post-delete extension fails and the fallback mutates $plan.PlannedOSPartitionSize, the local $resizeTargetPlannedSize variable was not updated; the subsequent post-delete Assert-PartitionSizeAfterResize failed on any surplus greater than 1 MiB and aborted the destructive sequence before New-Partition ran. The fix is a single reassignment. Reachable only when the post-delete extension fails; the happy path is unchanged.

nonFatalWarning set on fallback-copy failure. When the secondary LKG refresh at C:\Recovery\WindowsRE\winre.wim fails (typically an ACL denial), the run now sets $Script:nonFatalWarning = $true and exits EXIT_WARNING instead of EXIT_SUCCESS, consistent with the exit-code discipline.

Changed

Cosmetic log and comment corrections. Three log-message corrections: the Get-RegisteredWinREFingerprint caller log at the unreadable status no longer overstates when the recheck defers; the full-update Step 2 log line no longer fires when $needInject is false; Remove-StrayRecoveryPartitions uses the neutral prefix Stray-recovery cleanup: instead of Step 7:, which misled on the fast path, enable-only, and pending-reboot exit call sites. Three inline comments that still said v48 Patch-4 fix #N now read v48 patch 1. The elevation-guard comment now reflects that the guard creates the log directory itself on refusal.

Deploy-WimTransactional comment corrected. The comment claimed the rollback copy is cleared after both /setreimage and /enable succeeded; the implementation releases it after /setreimage succeeds and /enable has been attempted, regardless of /enable's return value. The reasoning was already correct — once the new WIM is in place and reagentc is pointing at it, restoring the old bytes would not change the outcome of an enable failure — the comment now states the actual boundary. The rollback-cleanup-site comment matches.

Migration

ScriptVersion moves from 47 to 48, so the SCRIPT component of DesiredStateId changes. Every managed machine performs one full-update pass on its next scheduled run, then returns to the fast path. No driver-manifest, OEM-map, or driver-selection inputs changed. The DSI bump is intentional: it is the version boundary that converges the fleet onto the v48 pipeline and ensures the LocalInputsId field is populated by every machine that takes the full-update path.

A machine whose state file records a v47 DesiredStateId will see it rejected as stale on the next run and take the full-update path. On the full-update path, the intervening-anchor handling either accepts the machine's layout or rejects it with a named reason and defers. A machine whose layout falls into the surplus or multi-intervening case will defer stably; the operator path is documented in CHANGELOG.md.

Field verification

The v48 intervening-anchor happy path is field-verified on the exact machine that motivated it: an AMD Ryzen 7 5825U laid out as C: (232 GiB, at SizeMin) | Storage (720 GiB, Basic Data) | Recovery (1000 MiB, type-coded). Under the previous release the same layout produced the plan rejection recovery-typed partitions are separated from C: by a non-recovery partition; under v48 the manager identified the storage partition as the anchor, validated it, shrunk it by 200 MiB, deleted the old recovery partition, created a 1200 MiB replacement at offset 975561 MiB, registered it, and reached Operating mode: DEDICATED with reagentc /enable exit 0.

The elevation guard is field-motivated by two 2026-10-05 runs on the same machine that failed after roughly four minutes each. The transactional WIM replacement's rollback branch, the v48 multi-intervening and surplus rejections, and the architecture gate on ARM64 hardware have not been exercised on physical hardware. The source-WIM hash cache fix has not been exercised on the enable-only fallthrough path. See CHANGELOG.md for the full gap list.

Known limitations

Six live limitations carry forward and are documented in CHANGELOG.md under "Current known limitations": the post-deletion failure corner on encrypted C:, unverified v45 failure paths, metadata-neutral Dynamic Update drift, multi-intervening recovery partitions, the intervening-anchor surplus case, and free-space deferral retry suppression.

Upgrade

git pull, or download the v48.2 release. No manual state-file action is required; the full-update pass is automatic on the next scheduled run. Rollback to v47 patch 3 is documented in CHANGELOG.md under the v48 patch 1 migration note.

Full notes, including the field logs and the review trail, are in CHANGELOG.md.