A simple backup solution using ImageX, a Windows Imaging tool
Published September 18th, 2010 in Microsoft, ProgrammingPrevious readers of my blog might already know that I am a big fan of ImageX, a tool that has been supplied by Microsoft in the Windows Automated Installation Kit since the release of Windows Vista.
A quick introduction
ImageX is a command-line tool that enables original equipment manufacturers (OEMs) and corporations to capture, to modify, and to apply file-based disk images (.wim files) for rapid deployment.
WIM files can capture disk or directory snapshots in such a that identical files are only stored once in the internal structure of the image. In addition to this, compression can be used to minimize the size of the final data.
These are some of the reasons I have been using ImageX to take full “snapshots” of all of my code, private files, etc. from time to time, for backup and archiving purposes. When needed, I can extract different revisions of the same file, or restore a whole image/snapshot in case of disk damage or data loss.
The graph on the left visualizes the changes to my projects backup file spread across 16 months. The last image’s actual data weighs at 64GB, while the whole WIM is 59GB—and it contains all file changes, directory structures, even information that has long been deleted from my working copy.
Requirements
- The scripts package. Download and extract to a folder of your choice.
- ImageX.
- Download and install the Windows Automated Installation Kit (WAIK).
- Copy the ImageX binaries (both amd64 and x86 folders), located in \Program files\Windows AIK\Tools\ to the backup\app\imagex folder.
The scripts
Capturing, mounting, or unmounting images requires administrative privileges, so you can either right-click the scripts and select Run as Administrator, or create a shortcut to the script and change its Compatibility options to always require elevation.
The script defaults are below. These can changed (in all four scripts, where used) as needed:
- C:\projects The folder to back up
- projects.wim (created and updated in the root backup folder) The Windows image to be used
- projects.YYMMDD-HHMM The image name template; it is dynamically updated based on the time when the capturing process is started
- mount (folder; located in the root folder) The mount folder to use
Mounting Windows images is only possible after installing the driver by right-clicking wimmount.inf (in the respective ImageX folder), and selecting Install.
Using the solution
Testing and using the backup solution is quite easy. After preparing the ImageX binaries and editing the script defaults as needed:
- Simply run the capture.cmd script to take the initial snapshot of the target directory.
- To verify that the new image is processed, you can run the info.cmd script. The command-line output will show information about all images, including the new one.
- Repeat when a backup is needed.
Of course, the process can be fully automated, by just referencing the capture.cmd in the scheduling program of your choice.
Search
About |

Stanimir Stoyanov is a programmer, Microsoft MVP, and Windows enthusiast. Read More...
He's currently working on an array of projects using Visual Studio 2010 on Windows 7.
Latest
- How the Active Directory – Data Store Really Works (Inside NTDS.dit) – Part 1
- Blocking unwanted advertisements and malware with a HOSTS file
- Multithreading with Windows Forms in C#
- Честита Коледа (и поздравления на спечелилите)!
- A simple backup solution using ImageX, a Windows Imaging tool
- Soon: MSDN Ultimate Subscriptions Giveaway
- Decoding FLAC audio files in C#
- Inline Tweet Translator
- Resizing forms while keeping aspect ratio
- Encoding uncompressed audio with FLAC in C#

One Response to “A simple backup solution using ImageX, a Windows Imaging tool”
Please Wait
Leave a Reply