“Disk Mode Write Filter” or “Resetting Differential VHDs”

The Enhanced Write Filter is also shipped with Windows Embedded Standard 7. However it does not include the Disk mode known from earlier Embedded versions. The Disk Mode allowed to save all the changes on a separate hard drive.

There is an alternative approach available to create a scenario similar to the EWFs Disk Mode – you can use VHDs.
Because Windows 7 and also WES7 support to boot from VHDs (Virtual Hard Disks) you can make use of the differential VHD feature.
This feature allows you to create one master VHD file containing the operating system in the state it should stay and a differential VHD which stores all the changes made to the master image during runtime.

image

For example you can have your Master VHD file on a Compact Flash and the differential file on a hard disk to redirect all the writes away from the flash media.

One feature from EWF is to discard all changes made to the image on every reboot.
The solution for this is to create a new differential VHD file with the master as parent and use the new VHD as default boot entry.
After a reboot the system is back in its original state.

Reset Differential VHD

To automate this process you can use the following batch file. Please adapt the paths to your VHD location in the “Variables” section. Have a look below for the installation of the batch file.

How it works

The system works with 2 differential VHD files which will be swapped out on every boot.
On each boot the batchfile checks which differential VHD is active.
It will then delete the non-active differential VHD and recreates the non-active VHD.
By this all previous changes are undone. Then the batchfile will set the new non-active VHD as new default boot device.
On the next start the system will boot from the fresh created VHD.

Batch File

 

@echo off
echo VHD Diff Resetter created by Wolfgang Unger

REM #########################
REM Variables
REM #########################
set VHD_Drive=D:
set VHD_Parent=wes7.vhd
set VHD_DiffFile1=wes7diff1.vhd
set VHD_DiffFile2=wes7diff2.vhd

set TempFile=D:\diskpart.txt
REM #########################

REM Try to delete the second diff file. if successful image 1 is bootet.
del %VHD_Drive%\%VHD_DiffFile2%
if exist "%VHD_Drive%\%VHD_DiffFile2%" goto File2

del %VHD_Drive%\%VHD_DiffFile2%

echo create vdisk file=%VHD_Drive%\%VHD_DiffFile2% parent=%VHD_Drive%\%VHD_Parent% > %TempFile%
echo exit >> %TempFile%

diskpart /s %TempFile%

bcdedit /set {current} device vhd=[%VHD_Drive%]\%VHD_DiffFile2%
bcdedit /set {current} osdevice vhd=[%VHD_Drive%]\%VHD_DiffFile2%

GOTO Done
:File2

del %VHD_Drive%\%VHD_DiffFile1%

echo create vdisk file=%VHD_Drive%\%VHD_DiffFile1% parent=%VHD_Drive%\%VHD_Parent% > %TempFile%
echo exit >> %TempFile%

diskpart /s %TempFile%

bcdedit /set {current} device vhd=[%VHD_Drive%]\%VHD_DiffFile1%
bcdedit /set {current} osdevice vhd=[%VHD_Drive%]\%VHD_DiffFile1%

:Done

del %TempFile%
echo Done.

Installation

  1. Install Windows Embedded Standard 7 to a VHD. Please have a look here for instructions.
  2. Boot the image.
  3. Save the batchfile from above to the image.
  4. Open Task Scheduler
  5. Click “Create Task…”
  6. Enter a name for the task and check “Run with highest privileges”
  7. Goto the “Triggers” tab an click “New”
  8. Select “At startup” from the “Begin the task” dropdown and click “OK”
  9. Goto the “Actions” tab and click “New”
  10. Browse to the batch file and click ok
  11. Click OK to save the task
  12. Run the batch file once and reboot

 

Usage Scenarios

This solution can be helpful when

  • using a flash disk drive which contains the master image and all changes should be located on a hard disk drive
  • changes should persist on reboots (for this do not create the task and execute the batch file only when needed)
  • you do not want to use EWF or FBWF
  • etc.

Post new comment

(If you're a human, don't change the following field)
Your first name.
(If you're a human, don't change the following field)
Your first name.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Glossary terms will be automatically marked with links to their descriptions. If there are certain phrases or sections of text that should be excluded from glossary marking and linking, use the special markup, [no-glossary] ... [/no-glossary]. Additionally, these HTML elements will not be scanned: H1, H2, H3, STRONG, a, abbr, acronym, h1, h2, h3, strong.
  • Minden email cím át lesz alakítva ember által olvasható módon, vagy (ha a JavaScript engedélyezett) ki lesz cserélve kattintható, de biztonságos hivatkozásra.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Please enter the sum of 11 and 1:
Solve this simple math problem and enter the result. E.g. for the sum of 1 and 3, enter 4.