Microsoft

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.

Editor's Picks