Repair and rebuild the Windows Recovery Environment (WinRE) on Windows 10 and 11.
Windows Recovery Environment (Windows RE or WinRE) provides built-in tools such as Startup Repair and Reset this PC to help repair or reset Windows.
WinRE Manager services winre.wim, injects the OEM and Intel VMD drivers the recovery environment needs, verifies the registered recovery route, and keeps the recovery partition correctly sized. Safe to re-run: a machine that needs no work takes an idempotent fast path that mounts no WIM, does not modify the OS-disk partition layout, and does not disable, re-register, or enable WinRE. Runs on one machine, or as a scheduled SYSTEM task across a managed fleet.
⚠️ Before your first live repair: WinRE Manager can modify disk partitions and can remove type-coded recovery partitions on non-OS disks. Read Before you run a live repair and run a dry run first.
💖 If WinRE Manager saves you time, sponsor the project. Sponsorship funds ongoing maintenance, testing against new Windows builds, and the OEM driver map updates that keep the tool working across vendor fleet changes.
| I want to… | Start here |
|---|---|
| Fix WinRE on my own PC | Quick start (README) — download, extract, double-click WinRE-Manager.cmd. No PowerShell knowledge required. |
| Inspect my recovery configuration | Testing — the diagnostic harness; test modes can create/download artifacts in its workspace without changing WinRE. |
| See what the repair would do before running it | Run WinRE-Manager.cmd and pick Option 3 — Preview plan (DryRun). |
| Back up WinRE before a repair | Run WinRE-Manager.cmd and pick Option 1 — Back up current WinRE. Restore from the same wrapper via Option 8 — Restore WinRE from backup, which is always shown and accepts any directory containing winre.wim (the backup.json metadata file is optional). |
| Free up disk space by removing old backups | Run WinRE-Manager.cmd and pick Option C — Clean up old backups. Lists every backup under every registered backup location with size and total, and deletes the ones you select after a typed DELETE confirmation. |
| Run WinRE Manager on a schedule | Run WinRE-Manager.cmd and pick Option 5 — Install automatic maintenance, which registers a SYSTEM scheduled task pinned to a stable installed copy of the script. Remove via Option 6. |
| Deploy to a managed fleet | Deployment — scheduled task XML, Intune, RMM. |
| Host my own manifest, maps, or base WIM | Self-hosting. |
| Understand how it works | Architecture — the four invariants and the pipeline. |
| Fix a specific error | Troubleshooting — log signatures and operator recovery steps. |
| Read the release history | Changelog. |
If Windows is telling you something is wrong with the recovery environment, find the message below and start there.
| Problem | Start here |
|---|---|
| Windows says it cannot find the recovery environment | Troubleshooting |
The Windows RE image was not found |
Troubleshooting |
reagentc /enable fails or reagentc /info reports Disabled |
Troubleshooting |
Windows Update reports 0x80070643 (recovery partition too small) |
Recovery partition |
| Startup Repair cannot repair the computer automatically | Driver injection |
| You want to inspect the machine without changing anything | Testing |
| You want to preserve the current WinRE before a repair | README § Advanced usage — -Action Backup -BackupPath <dir> |
The full error-by-error matrix — exact strings, causes, and what WinRE Manager does — is in the README.
Three audiences. All drive the same control flow on every machine.
flowchart TD
Start["Windows 10 / 11 machine<br/>with a broken or missing<br/>recovery environment"]
Start --> Who{"Who is running<br/>WinRE Manager?"}
Who -->|"Personal PC"| Single["One-off repair<br/>on your own laptop"]
Who -->|"IT admin / sysadmin"| Fleet["Scheduled deployment<br/>across a managed fleet"]
Who -->|"MSP / advanced"| Hosted["Hosting your own<br/>manifest, maps, and base WIM"]
Single --> RunOne["Run WinRE-Manager.cmd<br/>Backup · Check · Preview · Repair"]
Fleet --> RunFleet["Deploy WinRE.ps1 as SYSTEM<br/>via Scheduled Task / Intune / RMM"]
Hosted --> RunHost["Configure your own<br/>self-hosted sources"]
RunOne --> Flow["Same control flow<br/>on every machine"]
RunFleet --> Flow
RunHost --> Flow
Flow --> Check{"What does it find?"}
Check -->|"Nothing to fix"| FP["Tier 1 · fast path<br/>no OS-disk changes"]
Check -->|"WinRE registered, disabled"| EO["Tier 2 · enable-only<br/>prepare volume · re-register"]
Check -->|"WinRE missing or broken"| FU["Tier 3 · full update<br/>plan · shrink · rebuild · deploy"]
FP --> Dedicated["DEDICATED WinRE<br/>on a dedicated recovery partition"]
EO --> Dedicated
FU --> Dedicated
FU --> Fallback["OS-FALLBACK WinRE<br/>on C: · constrained fallback"]
style Start fill:#1f6feb,stroke:#1f6feb,color:#fff
style Dedicated fill:#238636,stroke:#238636,color:#fff
style Fallback fill:#9e6a03,stroke:#9e6a03,color:#fff
style Hosted fill:#8957e5,stroke:#8957e5,color:#fff
| You are | You should read |
|---|---|
| 💻 A single-machine user, repairing your own laptop | Quick start — download, extract, double-click WinRE-Manager.cmd |
| 🏢 An IT admin or sysadmin, deploying to a managed fleet | Deployment — run as SYSTEM under a scheduled task |
| 🔧 An MSP or sysadmin hosting your own inputs | Self-hosting — own manifest, OEM maps, and base WIM repository |
Every decision in the codebase follows these four rules, in this order:
reagentc /disable → reagentc /enable window.Rules 1–3 are invariants: no code change may weaken them. Rule 4 is the working rule — the discipline by which rules 1–3 are enforced on the fast path, the enable-only path, and the destructive path. Full hierarchy, enforcement tables, and reasoning: Architecture.
The destructive path is surrounded by protections implemented in the code rather than relying on operator assumptions. Every preparation — planning the partition layout, resolving and verifying the driver artifacts, building and normalizing the candidate image — completes before WinRE is disabled or any partition is deleted. A failure before destruction leaves the old recovery route intact; a failure during the destructive sequence restores the previous state where the design can, and names the one residual corner it cannot close. Default Repair requires elevation, x64 and an exclusive program lock. Its native-boot gate refuses a file-backed virtual OS disk with another nonvirtual disk, or an indeterminate topology; Backup and Restore dispatch earlier. The manager never modifies the OS volume’s BitLocker state.
The v49 release adds three pre-deployment gates that narrow what the pipeline will deploy: a source-ownership classification (a foreign WIM that a vendor populated with its own third-party drivers is preserved as-is rather than stripped and re-injected), a never-downgrade storage-driver check (a candidate image that would inject a storage driver older than one already present in the mounted image is discarded entirely — the source is preserved and the run defers), and a pre-deployment storage-applicability gate (the last refusal before the WIM is written to the active route: every present SCSIAdapter-class device on the machine must have at least one INF in the candidate whose HardwareID or CompatibleID prefix-matches one of the device’s IDs). The release also adds a backup and restore action set, a temporary crash-recovery scheduled task that resumes an interrupted Repair or Restore, and a stable install location for the permanent maintenance task. The v50 generation adds a manager config trust gate (the manager.json config file under C:\ProgramData\OEM\WinRE-Manager\, its containing directory, and that directory’s immediate parent are trusted only when the ACL owner is SYSTEM or Administrators and no Allow ACE grants a modify-capable right to a principal outside SYSTEM, Administrators, or TrustedInstaller; the extended check landed in v50 patch 3) and a resume-script staging design (the SYSTEM crash-recovery task executes a staged copy of the running script at C:\Recovery\OEM\Resume\WinRE.ps1 under an explicit DACL rather than the script’s original path; v50 patch 1 shipped the earlier protected-path guard, which v50 patch 3 replaced). The v50 patch 2 release adds a non-OS-disk sweep suppression boundary (the sweep in Remove-StrayRecoveryPartitions is suppressed entirely when the running OS is detected inside a known hypervisor, or fails closed when the detection is indeterminate, and any non-OS disk reported as File Backed Virtual is preserved individually). The v50 patch 4 release hardens the trust check further: Test-PathTrustedForSystem skips InheritOnly ACEs (the stock C:\ProgramData ACL carries an inherited CREATOR OWNER ACE whose (OI)(CI)(IO)(F) mask would otherwise trip the check), and the three-copy invariant is now a maintainer commitment in CONTRIBUTING.md. Staging cleanup uses Remove-StagingDirectorySafely (reparse-safe, no recursive delete), the parent-chain trust check is warn-only (the residual risk is accepted, not closed, and documented in SECURITY.md), and two lifecycle flags force a fatal exit when the safety of staging cannot be verified. Remove-StrayRecoveryPartitions also applies the internal-bus allowlist so USB, SD/MMC, iSCSI, Fibre Channel, and unknown-bus disks are preserved individually.
The full model — every protection, the code path that enforces it, and the residual corner the deliberate post-deletion failure test is intended to close — is documented in README — Safety by design, Architecture, Driver injection, and Recovery partition.
| Tier | When | What happens |
|---|---|---|
| Tier 1 — fast path | The machine is healthy. | No WIM is mounted, the OS-disk partition layout is not modified, no reagentc mutation is issued. Runtime is dominated by Windows’ own CIM and PnP enumeration. |
| Tier 2 — enable-only | The image is current and its dedicated partition passes the reuse requirements, but WinRE is disabled. | Prepare the target, re-register and attempt enablement. No partition geometry change or image rebuild. |
| Tier 3 — update or layout repair | The image needs servicing, the route is OS-hosted, or the dedicated recovery partition is inadequate. | A layout-only repair copies verified current/preserved bytes unchanged; normal servicing runs when needed. The verified candidate and trusted pending record precede partition mutations. Failures report the actual route and retain recovery material; they do not imply a working fallback. |
Full pipeline, checkpoints, and the state model: Architecture and State and idempotency.
WinRE Manager exists because “reinstall Windows” is not a repair. The full error-by-error matrix — the exact error strings, the underlying cause, and what WinRE Manager does — is in the README. The failure classes:
winre.wim missing from wherever reagentc points.winre.wim absent, corrupt, or the wrong build.reagentc /enable failures. BCD inconsistencies, access-denied paths, Audit Mode / OOBE / sysprep states.0x80070643 — the well-known example is the Windows 10 update KB5034441; the underlying failure is not KB-specific.WinRE-Manager.cmd option 1), a transactional restore (option 8), and a cleanup helper (option C) that removes old backup directories after a typed DELETE confirmation, so a failed repair can be rolled back to the captured state without unbounded accumulation of backup copies.Detailed write-ups:
| Failure class | Guide |
|---|---|
Missing or corrupted winre.wim, disabled WinRE |
Troubleshooting |
| Partition sizing and geometry | Recovery partition |
| OEM / VMD driver selection and injection, v49 pre-deployment gates | Driver injection |
| Build drift, stale images, deployment identity | State and idempotency |
| Exit codes and orchestration | Exit codes |
| Guide | Use it for |
|---|---|
| Deployment | Scheduled tasks, MDM, fleet rollout, and deployment-time translations of the four design invariants |
| Self-hosting | Replacing the manifest, OEM maps, and base WIM repository with your own hosting, including the v49 pre-deployment gates’ implications |
| Architecture | The four design invariants, the pipeline, the control-flow invariants, and the state-carrying artifacts |
| Recovery partition | Sizing, geometry planning, replacement behavior |
| Driver injection | OEM/VMD selection, downloads, validation, the third-party driver strip stage, and the v49 source-ownership classification, never-downgrade check, and storage-applicability gate |
| State and idempotency | DesiredStateId, checkpoints, deployment state, deferral sidecar |
| Testing | Read-only harness and recommended regression checks, including the storage-controller diagnostic |
| Troubleshooting | Log signatures and operator recovery steps |
| Exit codes | Full exit-code matrix and orchestration policy |
| Changelog | Release history and per-machine field evidence |
| Component | Version |
|---|---|
scripts/WinRE.ps1 |
v50 patch 5 (review candidate) |
scripts/Test-WinRE.ps1 (read-only harness) |
v40 |
scripts/WinRE-Manager.cmd |
(interactive wrapper; rewritten in v49 patch 1) |
v49 patch 1 shipped the ASUS-incident containment work, the native-boot VHDX fail-closed gate, backup and restore, the crash-recovery task, and a rewritten wrapper. v49 patch 2 corrected four instances of the same fail-open defect class and shipped the wrapper’s helper scripts. Full history: Changelog.
v50 patch 5 is the current development revision. It repairs inadequate recovery layouts independently of image ownership, preserves WIM bytes when only relocation is needed, and strengthens interrupted-operation recovery and deletion guards. Prerelease evidence spans seven physical machines across two dated script snapshots. On 24 October, the tested production snapshot completed three further recovery replacements and four fast paths on HP and Lenovo hardware; diagnostics reported no failures. Disposable Hyper-V tests also verified deployment, two post-deletion failure/retry cases, automatic recovery after forced termination, an actual WinRE boot, foreign-image preservation during relocation, and native maintenance installation. See the validation status.
v50 patch 4 is the latest published release; the development versions above await release. Ten fixes across the full-update failure paths, the trust-check helper’s three copies, and the resume-task lifecycle. The headline changes: Step 5 now fails closed when the currently-registered WinRE status cannot be classified; twelve additional failure exits preserve the resume task; Remove-StrayRecoveryPartitions applies the internal-bus allowlist so a type-coded recovery partition on a USB, SD/MMC, iSCSI, Fibre Channel, or unknown-bus disk is preserved rather than deleted; the Get-PartitionPlan size arithmetic uses explicit -gt comparisons on [int64] operands, fixing a Surface Pro 3 crash where the vulnerable [Math]::Max(0, —) form threw on a >2 GiB extend delta; Test-PathTrustedForSystem skips InheritOnly ACEs, and the three-copy invariant is now a maintainer commitment in CONTRIBUTING.md; the resume-script staging lifecycle gained reparse-safe cleanup, a warn-only parent-chain check whose residual risk is accepted rather than closed, and two lifecycle flags that force a fatal exit when staging safety cannot be verified. The harness advances to v39. ScriptVersion remains 50, so no fleet-wide rebuild.
v50 patch 3 was the previous release. It hardened the manager config trust gate by replacing the v50 ownership-only check with Test-PathTrustedForSystem (owner plus effective-DACL mask, split by object class), and replaces the v50 resume-task deny-list guard with a staging design: the SYSTEM resume task now executes a staged copy of the running script placed at C:\Recovery\OEM\Resume\WinRE.ps1 under an explicit DACL, not the script’s original path. The release also closes the correctness gaps identified by independent review: the Restore action preserves the resume task when it cannot confirm WinRE is enabled after a re-enable attempt (only ok counts); Remove-StrayRecoveryPartitions positively verifies each deletion with a terminating re-query; Get-GitHubBaseWinRE rejects an empty archive-parts list with a named reason; recovery-volume drive-letter normalization is scoped to the OS disk; Add-ManagerBackupRoot preserves volume roots; the drive-letter normalization block is fail-closed on a provider error; and Get-WorkDirCandidates fails closed on a volume-enumeration error. The wrapper ships additional fixes: cleanup reparse-point rejection; Restore catalogue enumeration with WIM-only acceptance; Start-Process argument quoting; non-zero exit on cleanup failures; a trust gate on the Restore picker; and a full Test-PathTrustedForSystem port in Cleanup-Backups.ps1. A follow-up revision later in the same cycle added four more corrections. Test-PathTrustedForSystem now fails closed on an unresolvable ACE SID rather than silently skipping it, and the same fix was ported to the duplicated trust helper in Cleanup-Backups.ps1 and the compressed inline trust check inside the wrapper’s Restore TARGET_COMMAND. Invoke-RestoreAction now captures the target WIM’s SHA256 before the deploy attempt and again on failure, preserving the state file, checkpoint, and deferral marker only when both hashes match; the resume-task persist flag is set unconditionally in the invalidate branch. Cleanup-Backups.ps1’s numeric-selection branch now handles the single-backup case correctly. ScriptVersion remains 50, so no fleet-wide rebuild. The harness advances to v38 with run logging and a -NonInteractive fix that now runs the parser self-test.
v50 patch 2 was the previous release. It fixed the GitHub Windows 10 URL builder for the restructured repository folder (Win10/ — Win10/x64/), added a non-OS-disk sweep suppression boundary for VM guests with passthrough disks, added a File Backed Virtual disk protection inside that sweep, added a per-driver diagnostic loop to the source-ownership classifier, and admitted SCSI for the running OS volume only in the workspace candidate filter. ScriptVersion remains 50, so no fleet-wide rebuild.
v50 patch 1 shipped the ownership-migration fix, the manager.json machine-wide config file, the destination-volume backup free-space preflight, the UNC resolution for mapped-drive backup paths, the resume-task protected-path guard, the two-level ownership check on the manager config directory, the empty-parent cleanup, and the aggregate stray-recovery summary line. ScriptVersion moved from 49 to 50 so the ownership migration fires on machines already on the v49 fast path — a machine that last deployed under v49 runs one full-update pass on its next scheduled run, then returns to the fast path. The wrapper now shows [8] Restore and [C] Cleanup unconditionally. The harness moved to v35. Full release notes: Changelog.
File Backed Virtual OS disk with another nonvirtual disk, or an unresolved topology, refuses Repair partition/WinRE work. Ordinary VHDX-backed guests are not refused by file format alone. Backup and Restore have separate checks.WinRE-Manager.cmd) launches it elevated for complete query results.C:\Program Files\7-Zip\7z.exe (installed via winget if missing).Full requirements and caveats: README § Requirements.
Selected results. Full per-machine evidence: Changelog.
| Vendor | Model | OS | Result |
|---|---|---|---|
| ASUS | PRIME H510M-D (i5-11400) | Win11 26300 | v47 patch 1 — clean non-destructive migration from v46 |
| AB8139 (DMI) | LX15PRO (Ryzen 7 5825U) | Win11 26300 | v48 patch 1 — first field validation of the intervening-anchor path on the exact C: \| D: \| Recovery layout that motivated it |
| Dell | Pro Max 16 Premium MA16250 (Core Ultra 7 265H) | Win11 26300 | v47 patch 2 — full rebuild with Dell WinPE11 A10 OEM pack; 64 drivers injected |
| ASUS | Vivobook X1504ZA (i3-1215U) | Win11 26300 | v47 patch 2 — C: actively encrypting at 91% during run; dedicated-partition path completed |
| HP | EliteBook 8 G1i 16” (Core Ultra 5 235U) | Win11 26300 | v46 patch 2 — clean destructive rebuild |
| Lenovo | IdeaPad 3 15IAU7 (MT 82RK) | Win11 26200 | v46 patch 1 — the machine that motivated the plan-clamp fix |
| (VM) | Hyper-V Win11 GPT / Win10 MBR | Win11 26300 / Win10 19045 | v45 patch 1 — destructive path verified on the Win11 GPT VM; MBR attribute-application path verified on the Win10 MBR VM (reuse path, not destructive MBR) |
The v44 patch 7 destructive path is field-verified on encrypted C: across eight distinct physical machines (Intel 12th–15th gen and AMD, Dell/HP/Lenovo/ASUS chassis). v50 patch 1 was field-verified on 2026-10-12: full-update, fast-path, and backup runs all produced clean logs; the ownership migration hash bridge fired; byte drift from the last deployment showed NO; and the temporary resume task registered and cleaned up on clean exit. Test-WinRE.ps1 passed 20/20 on the same machine, including both source-level mirror-binding assertions. v50 patch 2 was field-verified on 2026-10-13 on the same machine: three fast-path runs confirmed the new v50 patch 2 banner and the new Test-RunningInVirtualMachine verdict line (no known hypervisor signature (Manufacturer='ASUS', Model='System Product Name') -> treating as physical); no regression, byte drift NO, exit code 0. v50 patch 3 was field-verified on 2026-10-14: the backup action ran end-to-end on a second test machine, the extended Test-PathTrustedForSystem mask accepted the stock C:\ProgramData\OEM ACL, manager.json was written with BackupRoots count=2, and the run exited 0; the resume-script staging design was exercised on the project’s ASUS desktop test machine, where the running script was staged to C:\Recovery\OEM\Resume\WinRE.ps1, SHA256-verified, registered against the temporary resume task, and removed with its staging directory on clean exit. v50 patch 4 was field-verified on 2026-10-19 on the project’s ASUS desktop test machine: the fast-path run exited DEDICATED in 12 seconds; the warn-only parent-chain check fired on user-owned C:\Recovery\OEM and staging proceeded; the internal-bus scoping preserved the JMicron JMS539 USB disk (disk 5); and the elevated Test-WinRE.ps1 -NonInteractive run returned 27/27, including the tightened check 18 and the new checks 21 and 22.
Per-machine evidence, release-specific verification status, and outstanding coverage items are in Changelog and Testing.
Repository: github.com/ArthurJDurand/WinRE-Manager · Docs: ArthurJDurand.github.io/WinRE-Manager