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.
- The scripts package. Download and extract to a folder of your choice.
- 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.
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.