Using Push Button Reset to Enable Your Embedded Scenarios

Posted By J.T. Kimbell
Program Manager

When I first read the blog from Desmond Lee and Steven Sinofsky in early January on the new Push Button Reset features coming in Windows 8, I was pretty excited, and I immediately started trying to think of how Refresh and Reset could be useful.

So, what’s Push Button Reset? I like to describe it as the awesome next generation of the old “restore your specialized device” functionality previously found in Windows. Instead of just being able to restore your specialized device back to some pre-defined settings, you can actually now completely roll back to a previous state and even save your data easily, if you wish to. It’s also not like your traditional backup and restore experience: All this can be done in less than 20 minutes.

So, with the help of a great trio of engineers from our Windows Embedded team in Beijing (Shuxiang Wan, Dev, Nan Li, PM, and Song Tian,Test) I was able to pull together this blog article to really show the value of this new Windows 8 feature for Windows Embedded customers.

Resetting Your Specialized Device

Resetting your specialized device is exactly what it may sound like. For a particular device, the entire OS partition is reset back to a pre-defined state. This pre-defined state is represented by a WIM (Windows Imaging Format) file. To do this on Windows Embedded 8, perform the following steps:

Step 1: Prepare the system

1. Create an WES8 image with the following modules selected:

Enterprise Management \ Data Protection

  • Backup and Restore [WinEmb-Backup-And-Restore]
  • File History [WinEmb-File-History]
  • Windows Recovery Center [WinEmb-Windows-Recovery-Center]
  • Windows Recovery Disc (WinRE) [WinEmb-Windows-Recovery-Disc]

Storage and Data

  • Disk Management [WinEmb-Disk-Management]
  • Extensible Storage Engine (ESE) [WinEmb-Extensible-Storage-Engine]
  • File System Resource Manager [WinEmb-File-System-Resource-Manager]
  • Storage Spaces [WinEmb-Storage-Spaces]

2. Create a System Reserved Partition (hidden drive).

a. Check “Create separate system partition” during the installation in IBW

Step 2: Prepare the system to create a recovery image

3. Launch cmd.exe with Admin permission after system starts.

4. Disable any active Windows RE mapped to the currently running system.

a. Reagentc.exe /disable

5. Add Windows RE to the targeted WES8 device, assume system drive is mounted to C:

a. Copy winre.wim from the installation DVD (32bit /64bit)

e.x. Embedded 8 64bit Bootable IBW:\sources\winre.wim

b. Copy winre.wim to the local machine

        C:\windows\system32\recovery

6. Enable custom Windows RE.

a. Reagent.exe /enable

Step 3: Create a recovery image for reset operation

7. Set system to boot into WinRE for the next occurrence.

b. Reagent.exe /boottore

8. Restart the system.

a. Shutdown /r

9. Reboot into RecoveryEnvironment.

a. Select Troubleshoot -> Advanced Options -> Command Prompt

10. Create a recovery image.

a. Suppose the system drive is mounted to C:, backup system should be stored in another location other than the system drive, e.x. D:\recovery.

b. Create a folder to store recovery image (D:\recovery)

c. Run command: dism /capture-image /imagefile:D:\recovery\install.wim /capturedir:C:\ /name:”Reset Img”

11. Register the captured recovery image.

a. run: C:\windows\system32\reagentc.exe /setosimage /path D:\recovery /target C:\windows /index 1

12. Exit command window, continue to boot to WES8.

Step 4: Reset the system

13. Launch the application from Windows 8 UI.

a. Settings > Change PC Settings > Remove everything and reinstall windows

b. Select one of the two options: Just remove my file, Fully clean the drive

Refreshing Your Specialized Device

Refreshing your specialized device gives the same “fresh OS” benefit that’s provided by resetting a Windows 8 PC, but also provides the ability to retain some of the data on the device. Specifically, anything NOT located in the following directories will remain untouched:

  • %windir%
  • %programfiles%
  • %programfiles(x86)%
  • %programdata%
  • %appdata%\local
  • %appdata%\locallow
  • %appdata%\roaming
  • Any root-level folder that is also found on the recovery image (such as C:\YourCompanyName)
  • A handful of key registry keys and files

Armed with that knowledge, take these steps to Refresh your specialized device:

Step 1: Configure the system to enable the Push Button Reset feature

1. Create an WES8 image with the following modules selected:

Enterprise Management \ Data Protection

  • Backup and Restore [WinEmb-Backup-And-Restore]
  • File History [WinEmb-File-History]
  • Windows Recovery Center [WinEmb-Windows-Recovery-Center]
  • Windows Recovery Disc (WinRE) [WinEmb-Windows-Recovery-Disc]

Storage and Data

  • Disk Management [WinEmb-Disk-Management]
  • Extensible Storage Engine (ESE) [WinEmb-Extensible-Storage-Engine]
  • File System Resource Manager [WinEmb-File-System-Resource-Manager]
  • Storage Spaces [WinEmb-Storage-Spaces

2. Create a System Reserved Partition (hidden drive).

a. Check “Create separate system partition” during the installation in IBW

Step 2: Prepare the system to create a recovery image

3. Launch cmd.exe with Admin permission after system starts.

4. Disable any active Windows RE mapped to the currently running system.

a. Reagentc.exe /disable

5. Add Windows RE to the targeted WES8 device, assume system drive is mounted to C:

a. Copy winre.wim from the installation DVD (32bit /64bit)

e.x. Embedded 8 64bit Bootable IBW:\sources\winre.wim

b. Copy winre.wim to the local machine

        C:\windows\system32\recovery

6. Enable Windows RE.

c. Reagentc.exe /enable

Step 3: Create a recovery image for refresh operation

7. Create a recovery image.

a. Suppose the recovery image is stored to a different drive other than the system drive (e.x. D)

d. Create a folder to store recovery image (D:\recovery)

e. run command: recimg /createimage D:\recovery

Step 4: Refresh the system

8. Launch the application from Windows 8 UI.

a. Settings > Change PC Settings > Refresh your PC without affecting your files

An Interesting Scenario: Servicing via Refresh

We know from some research and conversations with customers that a sizeable chunk of Windows Embedded customers choose to service their devices by “re-flashing” them: basically, installing a fresh copy of the OS on the hardware. This often will take place at Service Pack time. Taking this knowledge about our customers and thinking about Push Button Reset, I wanted to put forth a possibly useful and interesting use of the Refresh functionality for you, our customers.

Let’s say you deploy cash registers all over the world. They all run the same software and are the same devices, but that software is configured differently for devices that ship to Little Rock, Arkansas, USA than those that ship to Inverness, Scotland. Traditionally, if you were to re-flash all these devices, you would either need to re-configure them after refreshing the devices, or create several different device configurations for servicing your devices all around the world.

However, consider the idea of ensuring that all device & application configuration is stored outside of C:\Windows, C:\Program Files or other system directories. In this scenario, one single reference device could have all updates applied to it and used as the Refresh wim for all of the cash registers. Refreshing “back” to this wim would update the cash registers so they would be secure and stable, while also leaving the user experience untouched. This would help reduce the cost and possible downtime that comes with mass “re-flashing” of devices.

Here are some specific steps that can be taken to fulfill this scenario.

1. Download updates (.msu) from Microsoft Download Center.

2. Create a directory on the development computer, and mount the recovery image to that directory by typing the following at the a command prompt (assume the D:\Mount is created directory and the recovery image is stored under the path D:\recovery\customrefresh.wim):

a. MD D\Mount

b. DISM /Mount-Wim /Wimfile:D:\recovery\customrefresh.wim /index:1 /Mountdir:D\Mount

3. Apply the update package (.msu) file by typing the following at a command prompt, replacing <file_path> with the full path to the configuration set:

a. DISM /image:D\Mount /Add-Package /Packagepath:<file_path>

4. Unmount the image and commit the changes by typing the following at a command prompt:

a. DISM /Unmount-Wim /Mountdir:D\Mount /Commit

Resetting or Refreshing from an External Storage Device

To support the above scenarios, you may want to refer to a wim stored on an external storage device, such as a USB flash drive. In order to do that, please see the following steps:

Step 1: Prepare the USB flash drive

  1. Make the USB flash drive* a recovery drive (assume E is the drive letter of the USB flash drive).
    1. Insert a USB flash drive
    2. Click Start, type create a recovery drive, select the Settings search scope, and then select Create a recovery drive

* The USB device needs to be recognized as “fixed media” by the system (e.g. a hard disk drive or flash drive).

Step 2: Create a recovery image

  1. Same commands are used for capturing and registering the recovery image. However, make sure to change the stored path of the captured image to the external storage device drive.
  2. If a recovery image already exists, the image can be copied over to the USB flash drive, but you’ll have to re-register the recovery image (assume the recovery image is stored under the path E:\recovery).
    1. For refresh, recimg /setcurrent E:\recovery

c. For reset, run: C:\windows\system32\reagentc.exe /setosimage /path E:\recovery /target C:\windows /index 1

Step 3: Refresh/Reset the system

  1. Restart the system and boot into WinRE using the USB flash drive.
  2. On the Windows RE Tools menus,
    1. For refresh, select Troubleshoot > Refresh your PC
    2. For reset, select Troubleshoot > Reset your PC

Additional Resources

· How to Deploy Windows RE

· How to Capture and Apply Windows, System, and Recovery Partitions

· How to Customize WinRE

How to Deploy Push Button Reset Features