Microsoft optimize

Create a custom recovery image for Windows 8's Refresh your PC tool

Greg Shultz shows you how to use Recimg in the command line to create a custom recovery image for Windows 8's Refresh your PC tool.

As I told you in last week's article, Refresh your Windows 8 system from a Recovery Drive, the Refresh your PC tool will find and backup all your data, settings, and apps. It will then install a fresh copy of Windows and restore all of your data, settings, and apps. However, the Refresh your PC tool does not backup and restore any desktop applications that you have installed. As I explained, Microsoft's reasoning behind this is that it is possible that a recently installed desktop application could be the cause of the instability.

I also mentioned that there is a command line tool, called Recimg, which will allow you to create your own custom recovery image that will contain your applications. Then, when you run the Refresh your PC tool it will back up all your data, settings, and apps and then instead of a fresh copy of Windows, it will restore your custom image as well as all of your data, settings, and apps.

In this edition of the Windows Desktop Report, I'll show you how to use Recimg in the command line to create a custom recovery image for Windows 8's Refresh your PC tool. As I do, I'll explain how it works.

Planning

When you use the Refresh your PC tool in it default configuration, it uses your Windows 8 installation DVD to perform a fresh install of the operating system. As such, you essentially have a brand new PC and any gremlins that snuck into the previous installation are now completely exorcised. When you create a custom recovery image and use it as the basis for the Refresh your PC tool, you will end up with a copy of your system at the time that you created the custom recovery image. As such, you will want to create your custom recovery image at a point in time when you know that your system is as pristine as possible.

For my test system for this article, I began by performing a default Refresh your PC operation using the Windows 8 installation DVD. That way I was assured of having a fresh installation with which to create my custom recovery image. I then installed several applications to simulate a base installation of the desktop applications that I want to include in my custom recovery image.

If you feel that your system is in stable condition, you can go ahead and create a custom recovery image. Or you may decide to do as I have done and perform a default Refresh your PC operation to ensure that your system is in a pristine condition, install your set of applications, and then create a custom recovery image.

The Recimg tool

Before we actually create a custom recovery image, let's take a few minutes to look at and understand how the Recimg command line tool works.

To begin with, it is important to understand that when you create a custom recovery image, it will only contain the desktop applications that you currently have installed and the Windows system files in their current state. Custom recovery images do not contain your data, settings, or apps as that information is backed up at the time you run the Refresh your PC tool.

When you create a custom recovery image, the Recimg tool will store the image in the directory that you specify using the default filename: CustomRefresh.wim. Keep in mind that you cannot rename this file or else the Refresh your PC tool will be unable to locate and use the image. When you create a custom recovery image, Recimg sets the new image as the active recovery image, meaning that Refresh your PC tool will automatically use this new image when you refresh your system.

As you can imagine, like a lot of other command line tools, Recimg uses a set of parameters to perform its various operations. In addition to creating custom recovery images, Recimg can also show you the currently active recovery image, disable the currently active recovery image, as well as change the currently active recovery image.

As you may gather, having the ability to change the currently active recovery image means that you can create more than one custom recovery image and then choose which one you want to use before performing a refresh operation. Keep in mind that in order to have multiple custom recovery images and adhere to the rule that the filename must be CustomRefresh.wim, you would have to create each one in a separate folder.

Table A lists all of the Recimg parameters along with Microsoft's descriptions.

Table A: Recimg parameters

Parameter Description
/createimage <directory> Captures a new custom recovery image in the location specified by <directory>, and sets it as the active recovery image.
/setcurrent <directory> Sets the active recovery image to the CustomRefresh.wim file in the location specified by <directory>. Windows will use this image when you refresh your PC, even if a recovery image provided by your PC's manufacturer is present.
/deregister Deregisters the current custom recovery image. If a recovery image provided by your PC's manufacturer is present, Windows will use that image when you refresh your PC. Otherwise, Windows will use your installation media when you refresh your PC.
/showcurrent Displays the path to the directory in which the current active recovery image is stored.

Creating a custom recovery image

To create a custom recovery image you'll need to start by opening an administrative Command Prompt. Bring up the Windows Tools menu by pressing [Windows] + X. When you see the Windows Tools menu, select Command Prompt (Admin). Then, when the Administrator: Command Prompt window appears, type a command like:

recimg /createimage foldername

Where foldername is the name of the folder in which you want to store your image. If the folder doesn't exist yet, Recimg will create it for you. Keep in mind that you should place the folder in the root directory and use a name that doesn't include spaces. In my example, I used C:\Refresh as the folder.

When I issued the command, the process of creating the image played out as shown in Figure A. (To make it easier to identify the steps in the screen shot, I added blank lines between each block of text.)

Figure A

Creating a custom recovery image will take a while to complete.

Once launched, the process runs through four steps. The first step of creating the image file goes pretty quick. Creating the snapshot take a bit longer, but is still rather quick. When it gets to writing the image, you might as well go get a cup of coffee or take a walk. As you can see, Recimg tells you that "this may take a while." On my test system, the process of writing the image took almost two hours.

As soon as the image is written, Recimg then performs the fourth and final step, which is registering the image. It then informs you that the process is complete, as shown in Figure B.

Figure B

Once the image is created and registered, the procedure is complete.

Recimg's other parameters

Once the procedure was complete, I ran thru each of Recimg's other parameters, as shown in Figure C, just to see how they worked. I first used the /showcurrent parameter to see how Recimg stores the location of the current active recovery image. As you can see, the path is a bit cryptic, but is configured specifically so that Windows RE can find it without the need of the regular operating system's drive letter and path designation.
\\?\GLOBALROOT\device\harddisk0\partition2\Refresh

I then used the /deregister parameter followed by the /showcurrent parameter. As you can see, after using the /deregister parameter, Recimg no longer knows that a custom image exists. If after using the /deregister parameter, I ran the Refresh your PC tool, I would then be prompted to insert the Windows 8 DVD, and the refresh operation would again run in its default mode. (Keep this in mind if you ever decide that you want to refresh Windows 8 and go all the way back to a pristine installation.)

I then used the /setcurrent c:\Refresh parameter followed by the /showcurrent parameter. As you can see, the current active recovery image is once again configured as my custom recovery image.

Figure C

Running through the commands

Running Refresh your PC

After I created my custom recovery image, I then booted my system from the USB flash drive Recovery Drive and ran the Refresh your PC operation. When I did so, the operation ran exactly like the default operation that I showed you last week (Refresh your Windows 8 system from a Recovery Drive) with the exception that it did not prompt me to insert the Windows 8 installation DVD. When it was complete, I found all of my desktop applications as well as all of my data, settings, and apps had been restored.

Versatile option

Just in case the versatility factor escaped you, let me point out that knowing about the Recimg command really increases your options for working with Windows 8 - especially if you regularly experiment with different hardware and software configurations that you only need temporarily or if you want to test beta software without ruining your system.

Using Recimg you can create multiple custom recovery images and still be able to use a completely fresh installation from the Windows 8 DVD. If you want to be able to easily switch between custom and default images, you can copy the CustomRefresh.wim to an external hard disk or USB flash drive for safe keeping and then copy it back anytime you want. On my test system, the CustomRefresh.wim weighed in at just 6GB, which make it easily portable.

Small issue

While researching this technique, I came across a Microsoft Support bulletin that indicated that after refreshing your PC using a custom recovery image, your printer may fail. Apparently, some printer settings get whacked out during the operation. If you experience that little quirk, the resolution is a simple three step operation:

  1. Go to Control Panel and open Devices and Printers
  2. Right click your printer and select Remove device
  3. Click the Add a printer command to reinstall the printer

What's your take?

Now that you know how to create a custom recovery image for the Refresh your PC option, you'll be ready to use it should the need arise. Have you used Windows 8's Refresh your PC tool yet? If so, did it get your system back into a stable state? As always, if you have comments or information to share about this topic, please take a moment to drop by the TechRepublic Community Forums and let us hear from you.

Also read:

Find more Windows 8 tips and tweaks on the TechRepublic focus page.

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

37 comments
studman411
studman411

Hi there,


Nice article very detailed.  One question though, will this work to install windows 8 on a NEW hard-drive?  I dont a windows installation DVD, i have a desktop i got from futureshop so i have a OEM version of windows.  

Gnyff
Gnyff

Interesting. Now I just need to figure out how to get the darn custom image on a removable media. When I generate a recovery drive, windows does not use the custom image - but just copies the standard one from the hidden partition.... :(

(I'm trying to migrate the Win8 of a Lenovo M72Z from it's original 500G drive to a 60M SSD. Not having much luck at the moment, though)

measterbro
measterbro

I get error 0x80070006 at 11% of the  writing of the image. I did a scan of the disk with no errors. I also did a format of the output external hard drive. Any suggestions?

John94903
John94903

Really, there are good programs with straight forward GUI interfaces for making full system images that can restore a system even to a brand new drive as well as wipe out a virus infected drive and put it back to a clean state. Macrium Reflect has a free version as well as a $50 paid version. Acronis True Image is another, and there are others. There's no reason to fight with hard to use software just because it's part of Windows. John

Greg Shultz
Greg Shultz

...what you mean when you say you couldn't get any of the Recimg parameters to work. If you were able to create animage, then the /createimage parameter worked. I have the sense that you have misunderstood something along the way... I encourage you to reread this article as well as the other articles in this series that came before it Refresh your Windows 8 system from a Recovery Drive http://www.techrepublic.com/blog/window-on-windows/refresh-your-windows-8-system-from-a-recovery-drive/7384 Be ready to use the Windows 8 Recovery Drive http://www.techrepublic.com/blog/window-on-windows/be-ready-to-use-the-windows-8-recovery-drive/7287 Create a Recovery Drive in Windows 8 http://www.techrepublic.com/blog/window-on-windows/create-a-recovery-drive-in-windows-8/7261 As far as getting your system to boot from USB, you need to check the Gateway Technical Support site at http://gateway-us.custhelp.com/app/answers/list/?cmpid=topnav

Louvile
Louvile

Recimg Parameters? Cant get them to work in powershell either I need more better advice on this topic if anyone has any I could use it in the meantime I will keep looking elsewhere! Thanks again!

Louvile
Louvile

I couldn't get any of the "Recimg parameters" to work! It made the image and saved it to a file but then what? I thought I had to set it, but how? I have a NE56R31 with windows 8 preinstalled I have already refreshed twice (that worked fine) and then put on an a copy of windows 8 pro and made the image no problem So I guess my question, is that the only image I have now the one I just made? (Did installing the windows 8 pro delete my old image?) And how can I put it on a USB and make it boot or my original image which is on a usb, (Thank God I did that) how can I get it to boot from usb?? the setting bios boot order doesnt seem to work so what now?? are there any detailed tuts on how to boot windows 8 from usb out there??? Any help or advice is greatly appreciated!! Thanks!! Lou

vrakeshis
vrakeshis

Hi, A great step-by-step article as usual from you. Is it alright to use C:\ partition for creating and keeping the custom recovery image ?? If yes, then during refresh, will it not get wiped off as Windows 8 installs itself again? After de-registering, or in general having never used recimg, is it possible to find out the factory/manufacturer??s recovery partition location and image source that Windows-8 Refresh uses by default ??? Thanks Regards, Rakesh

Greg Shultz
Greg Shultz

...wording from the error message it is difficult to say what went wrong. I suppose that it could be a corrupt image... You might want to try again. But first, get your Windows 8 system set up in a stable state with a minimum amount of apps, then create a complete system image . That way if the Refresh Your PC operation with your custom recovery images your fails again, you will at least be able to return to your stable state. See this article: Restore Windows 8 with System Image Recovery http://www.techrepublic.com/blog/window-on-windows/restore-windows-8-with-system-image-recovery/7464 If it fails again, then it is a good possibility that you have a corrupted custom recovery image and may want to create a new image custom recovery using the RecImg tool.

jasonladams2010
jasonladams2010

I have a totally new Windows 8 system & I got it set up in a stable state with a minimum amount of apps. I then grabbed an image using the RecImg tool & attempted a Refresh Your PC operation. It went through it's steps & then rebooted. On restart, however, it seemed to have forgotten all of the Windows 8 Start screen links & applications that I had on there. I then restarted the machine & everything came back, but only after I got a message that there was an error in the refresh in that nothing on the system had changed. Seeing that I then decided to make a couple of changes on the system ... I imported all of my 25,000-some-odd songs into Media Payer & installed WinZip. I ran Refresh Your PC again figuring it would at least restore without WinZip installed, but I got the same results as described above. Do I have a corrupted image? What should I do to get something that will restore?

jmbaynes
jmbaynes

Would this be a viable option for creating a custom image for distributing on multiple computers with the same hardware?

david.tredinnick
david.tredinnick

It is not a good idea, no matter how well documented, to tell people to store the image on the same drive! Recimg and and Win7 backup and Restore can all be reliably replaced with disk2vhd (a SysInternals product). The expertise in selecting the point-in-time and off-disk location should not vary.

carmelt
carmelt

I was interested in the article as I am trying to create an image for tablets and wondered how would this work if I wanted to image and restore a number of tablets. I would have to run a program to change the sid wouldn't I? Any suggestions.

d_tisdal
d_tisdal

C:\WINDOWS\system32>recimg /createimage c:\refresh Source OS location: C: Recovery image path: c:\refresh\CustomRefresh.wim Creating recovery image. Press [ESC] to cancel. Initializing 100% Creating snapshot 27% The recovery image cannot be written. Error Code - 0x80070001

John94903
John94903

A free program like Macrium Reflect can make a full image of your system whenever you want via a graphical interface and store it practically any where you want. The image can be restored quickly and easily from that single backup file, even to a brand new hard drive. Why is Refresh better than this? What are it's improvements that make it worth using? John

chasmay
chasmay

Great article as usual,Thank you. Why do I get this error? "The recovery image cannot be written. Error Code - 0x80070001" Any help would be appreciated.

Joneszee
Joneszee

FYI... this is a very good article... thank you.... I do have a simple question however.. Given I use this procedure to create the Recovery file while the system is working fine but later the drive fails, is it possible to 'recovery' from the recovery file that was created? I assume it is but will there be additional steps that's needed? I do back up our data on a daily basis so I also assume that I would have some additional work to recover it. Joneszee

Gisabun
Gisabun

.... That Windows had this feature. Too bad it won't work for Windows 7..... [OK, so that is *ONE* bright spot for Windows 8.]

demotricus
demotricus

I discovered this some time ago and it has saved me a whole lot of trouble on several occasions now. I`m Sooooo grateful to the OP who posted it. Pity theres a need for it though, -I`ve had to "refresh" (re-install) FIVE times now...

dameagatha
dameagatha

in response to tim.clark, yes, they should; and, they should also realize that if you are sophisticated enough to be dealing with your own virus issue that you have already ruled out recently installed programs, you have done a system restore, you have scanned with the top virus scanners, etc., and that you have come to the conclusion that it is somewhere in the windows system; therefore, perhaps offer an additional option of just refreshing the windows program without disturbing the rest of your computer. just sayin . . .

tim.clarke
tim.clarke

...that their products need a rebuild procedure *built in*. Now I've seen everything.

Mark W. Kaelin
Mark W. Kaelin

It is always a good idea to have a recovery plan for Windows, with Recimg you get a few more options. What is your Windows 8 recovery plan?

Greg Shultz
Greg Shultz

...talking about the image to be used for the Refresh your PC tool in Windows 8. This isn't a real backup. I agree you that a real backup should be on an external drive and should be done with something like the System Image tool.

John94903
John94903

Have you tried running ErrorChecking with both boxes checked ( or in a Command box, CHKDSK d: /R where d: is the letter for the drive you are using for the image). If there are errors on the drive you can get this sort of message. If you are writing to an external drive, try a different drive and see if that makes a difference. John

d_tisdal
d_tisdal

Thanks for the advice on Macrium John....works great! I downloaded a copy and have already tested it and it looks like the perfect solution!

Greg Shultz
Greg Shultz

...Macrium Reflect, but from the description on their site it sounds similar to the Windows System Image, but probably more powerful. In any case, MR would make a full backup of your system at that point in time whereas Refresh will make a copy of your data at that exact moment and then basically re-install the OS and then put all your data back. Because it doesn't actually move your data from one disk to another, Refresh your PC is very fast when compared to restoring from a system image. What makes it worth using is that it comes with the OS. Now, if you have already using something like MR, you'll just have to do some comparisons and see what works best for you.

Greg Shultz
Greg Shultz

...I am not sure that you can. A refresh operation is designed to fix an unstable system, not a completely dead hard drive. To recover from that type of catastrophe, you would want to restore from a system image, which you could do from a Recovery Drive and a set of image discs. I have not tried this, but If I am not mistaken, I assume that the Refresh your PC tool requires that a working copy of Windows 8 be present on the hard disk in order for the tool to run. So, assuming that you have a backup copy of your custom recovery image, that would mean that you would have to put in a new hard disk, install Windows 8, restore your data, copy your custom recovery image to the hard disk, and then run the Refresh your PC tool... Whew! But if it were to work, it could save you from having to re-install and reconfigure all of your applications from scratch. When I get some time, I'll have to experiment with this to see if it is possible.

d_tisdal
d_tisdal

Yes John...I did that and everything is OK with the drive. I've got 5 drives in the machine which is a Alienware. The drives are not being used in any kind of RAID setup. I did see a article addressing the error issue on Microsoft's site but Macrium is a much better solution for me now.

John94903
John94903

I guess it's partly a personal preference and the fact that I don't have a huge amount of data to deal with. Making a drive image, which Macrium Reflect does, is not inconvenient, so that's my backup choice for now. I really appreciate the quality of your articles and the clarity with which you write. John

Joneszee
Joneszee

thanks Greg for you feedback... I am not sure either...thus the question. Given the fact that some of the earlier SSDs fail more frequently than more recent ones I think I'll do both.... a custom recovery image and your suggested custom Recovery file (just in case). If you do a test, could you post your finding?... Thanks again.