Repository navigation
v50 patch 1
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.jsonmachine-wide config file atC:\ProgramData\OEM\WinRE-Manager\manager.json. Holds the backup-root catalogue read byCleanup-Backups.ps1; distinct from the state file (operational state), the deferral marker (retry suppression), the checkpoint (resumable work), and each backup'sbackup.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 containingmanager.jsonand 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-BackupActionverifies 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-ManagerBackupRootresolves a mapped drive-letter path to its UNC form viaGet-PSDrive.DisplayRootbefore storing it inmanager.json. - Resume-task protected-path guard.
Register-ResumeTaskrefuses 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-EmptyWorkspaceParentremoves the now-empty<volume>:\Tempdirectory left behind by workspace cleanup, but only when its leaf name is exactlyTemp, it is completely empty, and it is not a drive root. - Aggregate summary line for stray-recovery-partition cleanup.
Remove-StrayRecoveryPartitionsnow 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-SourceOwnershipClassificationnow takes-HistoricalImageHashand-HistoricalLineageId, read from a stale state file via the newGet-StaleWinREStateFieldshelper. The Manager-Owned classification matches the staged source hash against the currentstate.CurrentImageHashor 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 asForeign-With-Driversand preserved instead of normalized. New-DirectoryIfNotExistsandRemove-ItemIfExistDryRun-logging. Both helpers now log their "would create" / "would remove" line only when the action would actually happen.
Changed
.NOTESgains 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 Containercan return$falsefor a directory the process is demonstrably reading from on OneDrive-hosted paths)..NOTESVersionline updated to50.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. TheHIDE_BACKUP_ACTIONS_WHEN_NONEtoggle 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 -PassThruso 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 throughcmd.exeparsing. 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,-Quietdropped.Cleanup-Backups.ps1: root discovery frommanager.json. The helper now reads the manager config catalogue (with the same two-level ownership check asGet-ManagerConfig) and always includes the default root.-NonInteractiveno longer callsWrite-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.ps1and SKIP when it is not present. - v34 adds
Remove-EmptyTestParent, mirroring production'sRemove-EmptyWorkspaceParent. - v35 inverts the interactive cleanup prompt:
Delete test artifacts from $TestDir → (Y/n)withy=delete (default) andn=keep. The v34 form (Keep … (y/N), y=keep) was the reverse of what most operators read. Recordgained an explicit-Okdefault 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.ps1v35 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.