-
Notifications
You must be signed in to change notification settings - Fork 6
winre_restore.ps1
Corey Watson edited this page Dec 1, 2025
·
1 revision
Restore Windows Recovery Environment from downloaded files.
Restores Windows Recovery Environment (WinRE) by downloading Winre.wim and ReAgent.xml files from a specified URL and placing them in the Recovery folder. Fixes systems where WinRE has been corrupted or deleted.
Repairs Windows Recovery Environment on systems where WinRE has been damaged, deleted, or is non-functional.
- Windows 10/11
- Admin privileges required
- Network connectivity to download URLs
- Valid WinRE files hosted at specified URLs
- WinreWimUrl: URL to download Winre.wim file
- ReAgentXmlUrl: URL to download ReAgent.xml file
- RecoveryPath: Path to Windows Recovery folder
- Downloads files to TEMP then moves to Recovery folder
- Disables WinRE before restore, re-enables after
- Uses curl with retry and timeout
- Disables WinRE (reagentc /disable)
- Downloads Winre.wim from specified URL
- Downloads ReAgent.xml from specified URL
- Moves files to C:\Windows\System32\Recovery
- Re-enables WinRE (reagentc /enable)
- No secrets in logs
- Downloads from specified URLs - ensure URLs are trusted
- Modifies system recovery configuration
- 0: Success
- 1: Failure
[ INPUT VALIDATION ]
--------------------------------------------------------------
WinRE WIM URL : https://your-server.com/Winre.wim
ReAgent XML URL : https://your-server.com/ReAgent.xml
Recovery Path : C:\Windows\System32\Recovery
[ OPERATION ]
--------------------------------------------------------------
Disabling WinRE...
Downloading Winre.wim...
Downloading ReAgent.xml...
Moving files to Recovery folder...
Enabling WinRE...
[ RESULT ]
--------------------------------------------------------------
Status : Success
[ SCRIPT COMPLETED ]
--------------------------------------------------------------
- v1.0.0 (2025-11-29): Initial Style A implementation
- View Script Source
- Scripts - Back to script index