Skip to content

v50 patch 1

Choose a tag to compare

@ArthurJDurand ArthurJDurand released this 12 Oct 22:36
· 4 commits to main since this release

Ownership-migration fix, backup-location catalogue, and a set of hardening changes to the manager's durable state.

ScriptVersion moves from 49 to 50 so the source-ownership migration fires on machines already on the v49 fast path — a machine that last deployed under v49 performs one full-update pass on its next scheduled run, then returns to the fast path.

Added

  • manager.json machine-wide config file at C:\ProgramData\OEM\WinRE-Manager\manager.json. Holds the backup-root catalogue read by Cleanup-Backups.ps1; distinct from the state file (operational state), the deferral marker (retry suppression), the checkpoint (resumable work), and each backup's backup.json (per-backup metadata). Writes are atomic; reads are owner-gated.
  • Manager config ownership gate. Both the read path (Get-ManagerConfig) and the write path (Set-ManagerConfig) verify that the directory containing manager.json and its immediate parent are owned by SYSTEM (S-1-5-18) or Administrators (S-1-5-32-544). Two levels are checked, not one — an attacker who owns the parent can delete-and-recreate the child to steal ownership of that child between runs.
  • Destination-volume free-space preflight on backup. Invoke-BackupAction verifies the destination volume has room for the WIM plus a 100 MiB margin before creating the destination directory or starting the copy.
  • UNC resolution for mapped-drive backup paths. Add-ManagerBackupRoot resolves a mapped drive-letter path to its UNC form via Get-PSDrive.DisplayRoot before storing it in manager.json.
  • Resume-task protected-path guard. Register-ResumeTask refuses to register the SYSTEM crash-recovery task when the directory containing the invoking script grants any write-capable right (WriteData, Delete, DeleteSubdirectoriesAndFiles, TakeOwnership, ChangePermissions) to a non-admin principal (Everyone, BUILTIN\Users, Authenticated Users, INTERACTIVE).
  • Empty-parent cleanup. Remove-EmptyWorkspaceParent removes the now-empty <volume>:\Temp directory left behind by workspace cleanup, but only when its leaf name is exactly Temp, it is completely empty, and it is not a drive root.
  • Aggregate summary line for stray-recovery-partition cleanup. Remove-StrayRecoveryPartitions now emits one summary line per run enumerating what was or would be deleted, preserved-oversized, skipped-non-typed, or failed.

Fixed

  • Ownership migration hash bridge. Get-SourceOwnershipClassification now takes -HistoricalImageHash and -HistoricalLineageId, read from a stale state file via the new Get-StaleWinREStateFields helper. The Manager-Owned classification matches the staged source hash against the current state.CurrentImageHash or a historical one across a version boundary. Without the bridge, the version bump this release introduces would break the source-ownership classification for the exact machines the bump is meant to reach — a machine whose state file was written by v49 would be reclassified as Foreign-With-Drivers and preserved instead of normalized.
  • New-DirectoryIfNotExists and Remove-ItemIfExist DryRun-logging. Both helpers now log their "would create" / "would remove" line only when the action would actually happen.

Changed

  • .NOTES gains three design-invariant bullets (manager config ownership gate, resume-task protected-path guard, empty-parent cleanup) and a Critical lesson on provider-based path checks (Test-Path -PathType Container can return $false for a directory the process is demonstrably reading from on OneDrive-hosted paths).
  • .NOTES Version line updated to 50.1 (v50 patch 1). The provenance-marker section header is updated from "not load-bearing in v49" to "partially load-bearing in v50".
  • Wrapper: [8] Restore and [C] Cleanup shown unconditionally. The HIDE_BACKUP_ACTIONS_WHEN_NONE toggle is removed. The screens themselves now explain when no backup exists and require an explicit path rather than defaulting to a nonexistent one.
  • Wrapper: child-process runner for Backup, Restore, Live Repair, and Cleanup. All four use Start-Process -NoNewWindow -Wait -PassThru so the exit code and interpretation legend appear before the menu re-renders.
  • Wrapper: path prompts for Backup and Restore moved into PowerShell. A path containing & or other CMD metacharacters no longer passes through cmd.exe parsing.
  • Check-Update.ps1: cache removed entirely. The GitHub Releases API is now the primary source; the CHANGELOG-on-main is a fallback for when the API is unreachable or the tag format is unrecognised. Tag parser accepts more forms (v50-patch-1, v50_patch_1, v50patch1, v50.1, v50.1.0, v50). Single-URL timeout of 5 seconds. Parameters -CacheHours, -Force, -Quiet dropped.
  • Cleanup-Backups.ps1: root discovery from manager.json. The helper now reads the manager config catalogue (with the same two-level ownership check as Get-ManagerConfig) and always includes the default root. -NonInteractive no longer calls Write-Wait. Empty timestamped directories and the default hierarchy are removed after cleanup.

Harness (v32 → v35)

  • v33 adds two source-level mirror-binding assertions to the parser self-test (checks 18 and 19) that read the adjacent WinRE.ps1 and SKIP when it is not present.
  • v34 adds Remove-EmptyTestParent, mirroring production's Remove-EmptyWorkspaceParent.
  • v35 inverts the interactive cleanup prompt: Delete test artifacts from $TestDir → (Y/n) with y=delete (default) and n=keep. The v34 form (Keep … (y/N), y=keep) was the reverse of what most operators read.
  • Record gained an explicit -Ok default of $false (defensive only; every call site supplies -Ok).
  • Parser self-test count is now 20.

Migration: v49 → v50

ScriptVersion moves from 49 to 50, 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. ScriptPatchLevel resets to "1" in the v50 generation; it is not a DesiredStateId input.

A machine whose state file records a v49 DesiredStateId sees it rejected as stale on the next run and takes the full-update path. On the full-update path, the source-ownership classification runs with both the current and historical CurrentImageHash and LineageId values, so a machine that was manager-managed under v49 is recognized as manager-owned under v50 and its own prior deployment is normalized as before.

Rollback: change $ScriptVersion back to 49 and revert the v50 changes (manager config helpers, resume-task protected-path guard, empty-parent cleanup, historical-hash bridge, backup preflight, UNC resolution). Another fleet-wide rebuild occurs on the next run.

The harness Test-WinRE.ps1 moves from v32 to v35 in the same window. The harness has no ScriptVersion and no DesiredStateId; its version is its own marker.

Field verification (2026-10-12)

v50 patch 1 was field-verified on the ASUS PRIME H510M-D test machine (i5-11400, Windows 11 build 26300):

  • Full-update, fast-path, and backup runs all produced clean logs.
  • The ownership migration hash bridge fired (Ownership migration bridge: using historical CurrentImageHash from stale state file ...).
  • Byte drift from the last deployment showed NO.
  • The temporary resume task registered and cleaned up on clean exit.
  • Test-WinRE.ps1 v35 passed 20/20, including both source-level mirror-binding assertions.

The following v50 patch 1 features have not been exercised end-to-end: the manager config ownership gate's refusal branch on an untrusted ancestor; the resume-task protected-path guard's refusal branch on a non-admin-writable script directory; the backup free-space preflight's insufficient-space branch; the UNC resolution for mapped-drive backup paths; and the aggregate summary line on a machine with actual stray recovery partitions. These are covered by inspection and by the parser self-tests.

Full release notes

See CHANGELOG.md → v50 patch 1.