build-winpe.ps1 builds a bootable WinPE image that opens FreePartition automatically.
Booting from it lets you resize/move/format the system disk and recover files with no Windows running on it.
Experimental: WPF and the .NET runtime are not officially supported in WinPE. Test in a VM first.
Ready-made image: if you do not want to build it, download
FreePartition-WinPE.iso from the latest release and write it
to a USB drive with Rufus (partition scheme MBR, target BIOS or UEFI, file system FAT32) or copy it
to a Ventoy drive. The Clone Windows button of FreePartition, outside WinPE, shows the same
instructions.
| Item | Where | Notes |
|---|---|---|
| Windows ADK | https://learn.microsoft.com/windows-hardware/get-started/adk-install | Installer (adksetup.exe). Tick only Deployment Tools. |
| Windows PE add-on for the ADK | same page | Second installer (adkwinpesetup.exe). Install it after the ADK. |
| .NET SDK 10 | https://dotnet.microsoft.com/download | Used to publish the app self-contained. |
| A USB drive (4 GB+) | Optional. It is erased. Without it you only get an ISO. |
Open PowerShell as administrator:
# ISO only (test it in a VM: Hyper-V, VirtualBox...)
.\tools\winpe\build-winpe.ps1
# ISO + bootable USB drive (E: is formatted!)
.\tools\winpe\build-winpe.ps1 -Usb E:
Output: tools\winpe\out\FreePartition-WinPE.iso. Boot the PC from the USB drive (boot menu, usually F12/F8/Esc).
0xc1420117 (cannot unmount) or 0xc1420114 (mount folder not empty)Windows Security’s Controlled folder access (ransomware protection) can block Dism.exe from
deleting the files of the mounted image. The notification reads “Protected memory access blocked”,
app Dism.exe, blocked by Controlled folder access. A Defender folder exclusion does not fix it:
you have to allow the app.
Run in an elevated PowerShell (this allows both the ADK DISM and the Windows one):
Add-MpPreference -ControlledFolderAccessAllowedApplications "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\AMD64\DISM\Dism.exe"
Add-MpPreference -ControlledFolderAccessAllowedApplications "C:\Windows\System32\Dism.exe"
Or use the UI: Windows Security > Virus & threat protection > Manage ransomware protection > Allow an app through Controlled folder access.
Alternative: turn the protection off only while you build, then back on.
Set-MpPreference -EnableControlledFolderAccess Disabled
Set-MpPreference -EnableControlledFolderAccess Enabled
Then clean up the failed run and start again:
dism /Cleanup-Wim
dism /Cleanup-Mountpoints
Remove-Item C:\FPWinPE -Recurse -Force
.\tools\winpe\build-winpe.ps1
If Remove-Item reports files in use, reboot and repeat. If Windows blocks another program
(for example cmd.exe or MakeWinPEMedia), allow it the same way.
In WinPE the installed Windows is not running, so it can be copied consistently. Tools > Clone Windows to another disk… or the Clone Windows toolbar button open a guided window (outside WinPE they show how to get the WinPE USB drive instead) that lists the steps and marks each one OK, Skipped or Failed as it runs (for a step-by-step guide with troubleshooting, see docs/clone-windows/GUIDE.md):
reagentc /setreimage; WinPE has no
reagentc.exe, so the one of the copied Windows is used. If that fails too, the window says so: start from the new
disk and run reagentc /enable in an administrator Command Prompt.bcdboot (deleting hiberfil.sys from the copy so Fast Startup cannot resume
the old session). If bcdboot refuses the copy, for example an old Windows from a newer WinPE, the boot files of the
source are copied instead and its boot store is repointed to the new disk; the window then shows a warning.Things to know before using it:
Log\operations.log, and shown in the window’s log box.reagentc /enable; that run was before the app
used the copied Windows’ reagentc.exe.MakeWinPEMedia supports both.X: is the RAM disk).powershell.exe; the script adds the WinPE PowerShell/Storage packages, but support is partial.