1 Create a custom Windows 10 “factory recovery” partition – Win10.Guru
Go to ...

RSS Feed

Create a custom Windows 10 “factory recovery” partition

These days, most new computers with a pre-installed operating systems ship with a so called factory recovery option. This allows users to completely reset the computer by restoring an image stored on a specific factory recovery partition. The problem with factory recovery is that it restores everything the way the original equipment manufacturer (OEM) wants them. This might include a bunch of “bloatware”, useless software like “30-day trial of XYZ” or “Tweak your PC with this fabulous tweaker” and so forth. One of the first things any user wants to do when setting up a pre-installed Windows on a new computer is to get rid of all this bloatware.

In this post I will show you how to either replace the factory recovery partition with your own custom version, or to create one in case your computer does not have a factory recovery option and partition available to start with.

To begin, open This PC in File Explorer, right click the Windows partition C: and select Rename. Give the partition a distinctive name like “Windows 10“. It will help you later to identify the system partition. If you have no shared network folders on another PC available or alternatively no other partitions than Windows partition on this PC you are using to capture custom Windows image, create a new partition on any internal or external disk or share a folder on another PC on your network to store captured custom Windows image.

Customize your Windows exactly as you want it. When Windows 10 is working as you’d prefer, all required software installed, bloatware and unnecessary apps uninstalled, settings changed and user profiles created, boot computer from either a WinPE media or Windows 10 install media. When Windows Setup starts showing region and language selection, press SHIFT + F10 to open Command Prompt:

Click to open enlarged in a new tab.

Type DISKPART (#1 in next screenshot) and hit Enter to start the disk partitioning utility. When booting from PE or install media, drive letters might be different from what they are when booting normally. Enter the command list vol (#2) to check partition letters. We need to capture the Windows partition and save that captured install.wim file on another partition (internal or external drive) or on a shared network folder. Check what temporary drive letter your Windows system partition has, in my case now it is D: drive (#3). In case you are saving the captured image to another partition on the same PC, check its drive letter, too. In this example case I could have chosen drive E: (#4) as the location to save the captured Windows image.

Enter the command EXIT to quit DISKPART (#5).

In this example now, I want to store the captured image to a shared network folder named Storage on a another computer AGM-W10PRO03. To do that, I need first to initialize networking services with the command wpeinit (#6),  then map the shared folder on that PC to a drive letter on the local computer. For this example, I’ll map the shared network folder as drive Z: using the following command (#7):

net use Z: \\agm-w10pro03\storage

When prompted, I will enter the network credentials (Windows username & password) for that computer.

Path to a network share is told as \\server\share where server is the name of the computer where shared drive or folder is located, and share is the name that drive or folder is shared with. In my case I have shared a folder on drive I: on computer AGM-W10PRO03 as Storage, so the path is \\AGM-W10PRO03\Storage. Change yours accordingly.

OK, everything is ready to capture the Windows install image. In this example, I am capturing the Windows system from drive D: on the local computer to the install.wim file, saving it on a shared network folder on another computer mapped as drive Z: (#8):

dism /capture-image /imagefile:Z:\install.wim /capturedir:D:\ /name:"Recovery" /compress:maximum

Capturing custom Windows image. Click to open enlarged in a new tab.

The switch named /imagefile: followed by a path and filename tells the DISM command where to save the captured Windows image. Switch /capturedir: followed by the drive letter, colon and backslash tells DISM which drive contains the Windows installation I want to capture.

When it’s done, close the Command Prompt and restart the computer booting back to Windows normally.

Check the size of your captured custom install.wim file. In my case it was just under 7 GB:

Create a new partition on any internal disk. Make that partition one GB bigger than your install.wim and name it Recovery. Notice that if you create this partition on the same disk where Windows is installed, and that disk gets corrupted, you will also lose the Recovery partition. Therefore I recommend that you create the custom recovery partition on another disk. However, assuming your system disk will not die, you can also create the Recovery partition on it and use it anytime you need to restore a “factory recovery” image of your own making.

Download the latest Windows 10 ISO image, any edition. Mount it as a virtual DVD (double click, or right click and select Mount), copy its contents to your new Recovery partition. Browse to the Sources folder on your new Recovery drive, and delete the install.esd or install.wim file (only one of these will be present). Copy the captured custom install.wim file to this folder to replace the ESD or WIM file you just deleted (Recovery drive, Sources folder).

Open Notepad or any other text editor and paste the following code to a new text file. For my example, the Recovery drive has drive letter F: (highlighted blue in below code sample), change all three instances of drive letter F: to whatever drive letter your new Recovery drive uses. Script is for GPT partitioned UEFI devices; If using a MBR partitioned BIOS based device, change line bcdedit /set %guid% path \windows\system32\winload.efi to bcdedit /set %guid% path \windows\system32\winload.exe:

bcdedit /create {ramdiskoptions} /d "Ramdisk"
bcdedit /set {ramdiskoptions} ramdisksdidevice partition=F:
bcdedit /set {ramdiskoptions} ramdisksdipath \boot\boot.sdi
for /f "tokens=2 delims={}" %%i in ('bcdedit.exe /create /d "Recovery" /application OSLOADER') do (set guid={%%i})
bcdedit /set %guid% device ramdisk=[F:]\sources\boot.wim,{ramdiskoptions}
bcdedit /set %guid% path \windows\system32\winload.efi
bcdedit /set %guid% osdevice ramdisk=[F:]\sources\boot.wim,{ramdiskoptions}
bcdedit /set %guid% systemroot \windows
bcdedit /set %guid% winpe yes
bcdedit /set %guid% detecthal yes
bcdedit /displayorder %guid% /addlast

Please notice: lines 4 & 5 in the preceding code sample belong together but are shown as two text lines here because of word wrap. Line do (set ID={%%i}) is not its own command line, it belongs to and must be at the end of  the line preceding it. Here’s a screenshot:

Batch file in Windows Notepad. Click to open enlarged in a new tab.

Save the file as a Windows batch file with the extension .bat, and name the file as you wish. I named it  recovery.bat, saving it onto the desktop (folder C:\Users\Kari\Desktop).

Open an elevated Command Prompt, Enter the following command, replacing the path and filename with your actual values:


The batch file now creates a custom recovery environment and adds it to the Windows boot menu:

Running recovery.bat. Click to open enlarged in a new tab.

That’s it! Your Recovery partition is created and added to Windows boot menu:

When the Recovery boot option is selected, normal Windows Setup will be run and you can clean install your custom Windows from the newly created Recovery partition, with all settings, themes, installed software and applications, drivers and user profiles exactly as they were at the moment when you captured the custom image.

Notice that if the disk where Windows is installed gets corrupted, or if you replace the disk with the new one, the boot menu is not shown. In that case simply boot the PC from WinPE or install media, open Command Prompt and check drive letters with DISKPART as told above, then run Windows Setup from Recovery drive. For instance, if DISKPART shows your recovery partition as drive R: you can start restoring simply using this command: R:\Setup.exe.

In case you want to prepare for a total hard disk failure which forces you to replace all disks, or if you just want to be prepared for every scenario, you can also create a bootable USB flash drive from the contents of the new Recovery drive. This will give you a “recovery-on-stick” tool allowing a fast recovery using your custom recovery media simply by booting computer from USB flash drive and running Windows setup from it.



Author: Kari Finn

A former Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.

27 Responses “Create a custom Windows 10 “factory recovery” partition”

  1. Raymond Pare
    August 25, 2018 at 16:46

    I have been looking for exactly these instructions since I updated my laptop to win 10 from Win 7. Thanks for the very clear and well explained text. I was a tech doing first line servicing for a departmental Vax 11-750 during the ’80s at Queens university Kingston so I was immediately interested by your Bio Kari. One interesting fact I noticed when I had finished was that my OS had upgraded to Win10 Pro from Win 10 home. I am not sure if this happened during this process or not. I haven’t tried the recovery yet but I have no doubt it will work as advertised. Thanks again Ray Pare.

  2. August 25, 2018 at 16:56

    Thanks Raymond!

    I have not a faintest idea why your edition was switched from HOME to PRO, I just must to admit it.

    Having said that, do you remember how “cool” it was to do Cobol and Fortran code for VAX, how “from the future” the VMS operating system was?

    I still think those years as best in my life. The feeling to be allowed to be in the front row to follow computing evolution was a fabulous feeling.

    When studying, I got a special permission to connect to uni’s VAX machine from home using my then “superfast” 1200 baud modem. I can remember it to end of times how cool I felt first time when the connection worked.

  3. August 25, 2018 at 17:03

    Dear Raymond:

    Indeed, thanks for your kind and insightful comments. Ditto to Kari! This discussion brings back some fond memories for me, too.

    The first system I managed while still in grad school in 1979 was a DEC PDP-11/70. I started working on a DEC 10 later in grad school. But I really got into VAXen at Schlumberger, where I ran a development team that built a well logging API environment to permit re-processing of log files after they were collected. My crowning achievement was to write a DEC CLI (Command Language Interface) program that let us create a custom User Interface for a FORTRAN application at runtime, by presenting the operator with a questionnaire at the outset of processing, and then using the responses to build a tailored UI for their particular processing needs on the spot. It was fun, and pretty advanced stuff for 1984/85 when we developed the package and its supplementary utilities. Those were good times.

    Thanks again for sharing your feedback and comments with us.
    Best wishes,

  4. Raymond Pare
    August 26, 2018 at 22:30

    Hi Ed and Kari, Just a follow up to my comment to say that I tested the Widows recovery partition and all is well. I also used the partition to make a bootable memory stick as suggested and that works also. I must have a lot of stuff on my laptop as the image file was 22Gb but that may be due to iTunes, you don’t need too many movies to make 22Gb.
    My first introduction to DEC was to a PDP5 at Queens in 1970; discrete components with Germanium transistors and 5K of core memory with a self modifying bootstrap that you keyed in with switches if it wasn’t retained in memory. Thanks for the walk down memory lane, though mine is not what it once was as evidenced by the fact I had forgotten about upgrading my laptop in 2017, I plead old age and Spinal Cord surgery.

  5. August 26, 2018 at 23:34

    Raymond, good to know your recovery media passed the test.

    About the size, this is up to each user. As I store all personal data in OneDrive, I clean up the computer of all kind user data before creating the recovery partition. Restoring it is so easy, just set up OneDrive.

    On the other hand, there’s nothing wrong to include your music, photos, videos and such in recovery media. Of course it makes the recovery process slower because recovery image will be bigger, but you will get a completely restored system without any further actions.

    According to an old Finnish proverb, one likes mother, the other prefers daughter. That describes this quite well: each user is different and prefers different approach.

  6. October 26, 2018 at 19:53

    Everyone is BS’ing and praising but no one tried it: its faulty and not working. thanks for nothing
    (check the false batch file commands for the bootloader entry)

  7. October 30, 2018 at 05:40

    It is tested, it works, there’s nothing wrong with boot menu entries shown. I am sorry that you were not able to follow the instructions.

  8. December 8, 2018 at 03:00

    Dear Kari,
    Many thanks for detailed instructions. We only have one issue which is when we try to use the Recovery option.
    1- Every time Windows 10 is restarted, it goes into the screen where it shows two tiles, first is to boot into windows10, the second is to boot into “Recovery” (Blue buttons).
    It would be nice to know how to not interrupt normal reboot with such options unless certain key is struck during the boot.

    2- When we choose “Recovery” during the boot options menu, it seems to start loading but when the progress bar at the bottom of screen finishes, it simply reboots back to the same boot options screen.

    However, if we choose the troubleshooting options and then “Command Prompt”, if we switch drives to the Recovery drive letter and run the SETUP.EXE from there, we can follow through with the recovery successfully.

    So any ideas about the above challenges?

    Your insight would greatly be appreciated.

    • December 18, 2018 at 14:42

      Tony, I must apologize for the delayed reply.

      1.) Press WIN + R to open Run prompt, type msconfig and hit Enter. Select boot tab and change the boot menu timeout from default 30 seconds to for instance 3 or 5 seconds. This will show the menu for just enough time to select Recovery when necessary. See screenshot: https://win10.guru/wp-content/uploads/2018/12/MSCONFIG.jpg

      2.) I am sorry but I cannot think of anything that could cause it not working, especially as you say that launching recovery (Windows Setup) manually from Command Prompt works.

      Not much help, I am afraid.

  9. December 17, 2018 at 05:11

    Hi, Terrific instructions just a couple of questions. I already have an existing factory recovery partition;
    1) how do i find which partition it is if it not obvious?
    2) can I use theses steps to over write the recovery partition.
    Thanks in advance

    • December 18, 2018 at 14:50

      1.) Best option to check which partition is what is to use Disk Management (WIN + X, select Disk Management).
      2.) Yes. For instance, on this HP ProBook laptop I am using at the moment to reply to you, I formatted the original HP’s OEM Recovery partition and use it as my custom recovery partition. However, I recommend creating a full system image backup containing everything on system disk before proceeding, in case you for any reason need to restore the original OEM partition anytime in the future.

  10. January 6, 2019 at 03:01

    Kari, in your latest post in response to majciceEddie your wrote:
    “Yes. For instance, on this HP ProBook laptop I am using at the moment to reply to you, I formatted the original HP’s OEM Recovery partition and use it as my custom recovery partition.”

    it would be much appreciated if you could elaborate on how you achieved that with existing non-commercial tools from MS or open source.

    • January 6, 2019 at 03:40

      A good question. As the reply would be simply too long, I decided to write a new post about how I setup new machines which come with preinstalled Windows. Give me a couple of hours, I’ll post a link here when the post is ready.

      • January 6, 2019 at 07:08

        Tony, I am sorry but it’s 7 AM here, I need to sleep a bit before writing that post. I was somewhat distracted when replying to you earlier. The ice-hockey World Junior Championships 2019 (https://www.iihf.com/en/events/2019/wm20) have been going on in Victoria and Vancouver, British Columbia. Your comment was posted and I replied to it in middle of second period of the final, gold medal game, my native Finland playing against USA. My plan was to write the post after the game, but as we won (Yes! Finland is World Champion), I just continued watching the after game show on Finnish television. The problem is, British Columbia time is 9 hours behind my local time, game ending and after game show starting at 4:30 AM my time.

        Long story short: I’ve got some single malt to celebrate, was flying beyond our galaxy in my dreams. It’s past 7 AM. I’ll sleep first, write the post when back on earth 🙂

  11. January 6, 2019 at 20:03

    If ran through the above article and figured it out. Just like to know if there is a way to incorporate future updates for my computer into the recovery image without going through the whole process again. Is that doable? If so, how?

  12. January 7, 2019 at 02:57

    Congrats on the win!!! Get some sleep for now. Look forward to reading your new post.

  13. January 7, 2019 at 03:44

    Just refreshed after posting my note about the game win, and noticed you had already posted the answer. You are FAST Kari… I am guessing the speed is why the finish team won 🙂

    One last question, if I were to have a programmer create a Wizard (GUI) to perform the entire process you have detailed above for “capturing a custom image, creating a new partition on the same drive as the O/S, copying all the required files, and setting it as the custom recovery partition”, what would be the best language to have it written in?

    I am hoping to create a program (non-commercial) to have a non-techy staffer perform the custom image process, then use the new recovery option during the boot to re-image the machine in future if need be. We have a number of laptops that would need to be re-imaged often.

  14. Fikri Kusuma
    January 7, 2019 at 10:47

    Successfully created the recovery partition with following your procedure. But I’d like to know since I’m using a windows tablet, I cant use the touchscreen after entering recovery partition. Is there any way to enable it?
    Another question how to relate that created recovery partition with existing recovery created by windows CD? So that when I refresh the windows with deleting all user data, I could get my driver installed

  15. Daniel
    April 3, 2019 at 07:20

    Hey! I messed up the batch file portion i believe. System keeps booting to the recovery/install partion with no “choose which operating system”.. Main os is on C and recovery is on D

  16. Daniel
    April 3, 2019 at 07:40

    Got it booting to correct os.. Having one more go ?

  17. Scott
    April 5, 2019 at 00:55


    I am interestingly curious as to why this needlessly more ‘complex,’ for lack of a better word compares to a more ‘refined’ method such as this https://www.youtube.com/watch?v=wUBTMkkKdaU

    Genuinely curious is all. For disinclined users that is.

    • April 6, 2019 at 00:24

      Apparently you have not read the post, or you did not understand it.

      What you call “more refined” method is nothing else than a normal clean install. When used to recover Windows, it wipes the existing Windows installation, and performs a normal clean install, user losing all installed software, personal data and settings. I do not need a recovery partition for that, I can always clean install from USB flash drive.

      Quoting you, the “needlessly more complex” method told in this post keeps everything intact. All user accounts, their personal data and settings, as well as installed software will be captured to recovery image, and restored when Windows Setup is run from recovery partition. Honestly, this is more “refined” method. In addition, no registration for a third party tool is required, no third party tools needed at all.

      Nothing personal, just expressing my personal opinion: I find it quite weird that for you a standard clean install of Windows is more “refined” option than restoring / recovering everything.

  18. Ben
    April 7, 2019 at 20:45

    Hi Kari,

    Fantastic guide! Just what I needed.

    Would you mind elaborating the final paragraph a bit more on how to make a “recovery-on-stick” version of the recovery partition?

    I used a USB external drive as my “recovery partition”, but unsure how to make it a bootable option for more flexibility 🙂

    • April 7, 2019 at 22:38

      Usually, the custom install.wim is bigger than 4 GB, so it makes usual methods to create Windows 10 USB install media impossible due ridiculous FAT32 file system 4 GB file size limit.

      My way to do custom W10 USB flash drive install media with large WIM file:

      1.) Mount a Windows 10 ISO, and using it, create a USB install media as told in this post: https://win10.guru/usb-install-media-with-larger-than-4gb-wim-file/
      2.) When done, replace the original install.wim in Sources folder on NTFS partition with your custom install.wim

      On my own network, I use Microsoft Deployment Toolkit to deploy (install) Windows to all physical and virtual machines. A nice feature in MDT is that I can use my custom WIM as operating system to be deployed. I simply import the custom WIM file to MDT, and deploy it to a target device. Nice and easy!


  19. Ben
    April 8, 2019 at 13:17

    Awesome! Thank you so much 🙂

  20. Suchi Gate
    April 23, 2019 at 00:23

    I Fixed the problem when you delete disk Letter. it was pretty big challage for me but after browsing some microsoft docs and some try and errors I made it.

    1. Delete disk Letter from your recovery disk partition in disk manager or in CMD with diskpart command
    2.in CMD use command diskpart
    3. list disk < here you find your disk, I used size to find what disk i want, it is size of whole disk, hardware
    4. select disk 0 <or any number what has your disk
    5. list partition < here you will see all partitions/volumes again, find your Recovery disk here
    6. select partition 1 < number of recovery disk partition.
    7. partition detail <here you can see if it is your recovery disk + all its details
    8. here we need to check/ change values at type what is partition ID and attrib what is Attribute
    when you have selected your recovery partition just type or copy this:
    SET ID=de94bba4-06d1-4d40-a16a-bfd50179d6ac <this is Ms recovery partition ID
    GPT ATTRIBUTES=0X0000000000000001 <this will allow to have disk without Letter in windows but
    it will get letter during instalation in recovery environment

    I did this in CMD from recovery environment, but probably you can do it in windows as CMD with admin rights

    I am pretty proud of myself 😀 I am total newbie in this but I am looking forward to make my career as Cisco network engineer

Leave a Reply