Skip to content

Win32-based UI application for backup and restore of Windows-based system images (Windows partition) using Windows Imaging Format (WIM) in WinPE environment.

License

Notifications You must be signed in to change notification settings

cregx/wim-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WIM-Backup

License Visual Studio GitHub issues GitHub closed issues Code-Signed Wiki available GitHub release (latest by date) Commits since release GitHub stars Github All Releases

The UI application "WIM-Backup" offers the possibility to create offline backups of Windows partitions (e.g. hard disk C:) in a WinPE environment. The Windows Imaging Format (WIM) is used for this purpose.

WIM-Backup-Social-Media-Logo

WIM-Backup is a Win32 application created in (Microsoft) C and Visual Studio 2010. Of course, you can also compile the project using a newer version of Visual Studio, such as 2019, or you can use an already compiled release version.

The advantage of WIM-Backup

WIM-Backup offers a free backup option for a Windows-based system. So you don't always need a commercial software.

The story behind the solution

In the process of troubleshooting and fixing bugs on Windows 10-based systems, I repeatedly had to perform new installations of the operating system. This process proved to be very time-consuming in some cases. So I came up with the idea of backing up the Windows image so that it could be restored without much effort if necessary. This was the birth of WIM-Backup.

wim-backup UI

Components of the solution

The solution consists of the following four components:

  • wimbckup.exe: GUI-based application of the WIM-Backup solution
  • action.bat: batch script responsible for executing the backup (creating the WIM file) and restoring the system from a WIM file
  • diskpart.txt: parameter file with instructions for diskpart, which is needed for the restore process
  • winpeshl.ini: template file for the execution of WIM-Backup (wimbckup.exe) within the WinPE environment

Rough flowchart

The following sketch roughly illustrates the essential relationships.

wim-backup rough flowchar

Brief summary

  • WIM-Backup always requires an external bootable media such as a USB flash drive.
  • From this drive WinPE is booted to perform a backup or restore to or from an external medium (e.g. a USB hard drive).
  • On the bootable USB flash drive the WinPE must be set up before (is documented illustrated in the readme).
  • After completion of the respective operation, a status message is displayed whether the operation was successful or failed.
  • After restoring a backup, you can boot normally from the destination drive.
  • Both the backup and restore process are relatively simple (not "rocket science").
  • To set up the solution, you need about 30 minutes time in the best case due to the necessary downloads (e .g. ADK)
  • Last but not least: it has a permissive license (non-proprietary) and is open source.

Typical application scenarios

  • Complete backups of Windows systems (examples: a) for pure data backup purposes, b) to perform fast and valid tests after performed adjustments to the operating system environment).
  • Transfer of the backed up environment to other hardware.

How to prepare WIM-Backup for operation (step-by-step guide)

The instructions described below are necessary because the solution requires the use of a WinPE-based boot medium. However, this must not be made available for licensing reasons.

In short: I am not allowed to provide a bootable ISO file with the solution. You will have to create it yourself.

  1. Download a current release version of WIM-Backup (or compile your own customised version).
  2. You will need the Deployment and Imaging Tools from Microsoft. These can be found in the Windows ADK (Windows Assessment and Deployment Kit). Be sure to download the appropriate ADK version for your development environment (your Windows version). Make sure that you have selected the Deployment Tools in the features.

adk-installation-screenshot

  1. In addition, you need the Windows Assessment and Deployment Kit Windows Preinstallation Environment Add-ons (see download link from ADK). These are installed following the ADK setup.

winpe-addons-installation

  1. Assuming that the processing of the previous steps was successful, the next step is to create a WinPE-enabled boot medium. This contains the WIM-Backup solution. To do this, start the Deployment and Imaging Tools Environment with administrative privileges.

  2. Copy the amd64 directory to a folder that does not yet exist, for example C:\Temp\media.

Tip: Copy the desired commands to the clipboard (to the right of the respective command), this way you can speed up the creation process considerably.

copype amd64 c:\Temp\media

copype-to-media

  1. Then mount the boot.wim image from the previously copied amd64 directory to the newly created c:\temp\media\mount directory.
dism /mount-image /imagefile:C:\Temp\media\media\sources\boot.wim /mountdir:C:\Temp\media\mount /index:1
  1. Create the folder Tools in the directory C:\Temp\media\mount.
mkdir C:\Temp\media\mount\Tools
  1. Now copy the following release files into this folder:
  • wimbckup.exe
  • action.bat
  • diskpart.txt
  1. You also need to copy the winpkeshl.ini file to C:\Temp\media\mount\Windows\System32.

  2. Finally, the mounted image must be un-mounted and the WinPEMedia ISO file must be created.

Do not forget to close all windows/files/applications that are open on the mounted directory. Otherwise, DISM will complain that it cannot complete the unmounting process.

dism /unmount-image /mountdir:C:\Temp\media\mount /commit
cd ..
cd "Windows Preinstallation Environment"
MakeWinPEMedia.cmd /iso C:\Temp\media C:\temp\wim-backup-114.iso
  1. After having created the WinPE-ISO file, we can now use Rufus to transfer it to a USB flash drive to boot from and create a WIM-based backup or restore an existing one: Rufus on GitHub GitHub Repo stars

Of course, any other tool, such as Ventoy, can also be used for this purpose - so it doesn't necessarily have to be Rufus: Ventoy on GitHub GitHub Repo stars

rufus-create-bootable-drive

WIM-Backup in action

The following animation shows WIM-Backup in action when creating a backup.

For more information about WIM backup, such as how to use it, see the Wiki.

wim-backup-animation-optimized

FAQ

❓ How much time should I expect to spend trying out the solution in my environment?

It is very difficult to give a general answer to this question. I estimate the time required to work through the instruction steps at around 30 to 60 minutes.

❓ Why is no bootable, i.e. ready-to-use ISO image incl. the WIM backup solution offered?

The issue is with the license terms. According to this, I am not allowed to provide a pre-built image based on WinPE. That is the reason why every developer has to create his own ISO image. The internal use of this image (within the own team) should then not be a problem.

❓ How are errors that occurred during backup or restore reported?

WIM-Backup uses the dism.log file to identify possible errors. To do this, this file is checked for the occurrence of the pattern "Error" and a general error message is issued after a backup/restore operation is completed.

You can find the dism.log file under the following file path: %systemdrive%\Tools\dism.log. Here, the %systemdrive% environment variable in WinPE normally points to the x:\ drive.

❓ Are there any known limitations to using WIM-Backup?

Yes, the list below shows the currently known restrictions:

  • If you want to backup a BitLocker-encrypted drive, you must first stop active BitLocker protection (BDE) in Windows. However, this does not mean that you have to decrypt the encrypted drive first. Once you exit BDE protection and restart the PC to boot from WinPE into the solution, WIM-Backup can access the drive. However, if you forget this step, WIM-Backup will not recognize the BDE-encrypted drive.
  • During the restore process, you can restore an existing WIM backup image on the C: drive only. Restoring to other drives is not supported. However, for partial restoration of the image, such as recovering specific files or directories, it is possible to use third-party programs like 7-Zip to extract parts of the backed-up data to other drives.
  • WIM-Backup can only create offline backups. Attempting to backup a system while it is running, that is, the operating system has booted properly, results in an error.
  • An overview of the operating systems tested with WIM-Backup can be found in the Wiki.

Stargazers, Forkers & other users

Thanks to all for using WIM-Backup.

Stargazers

Stargazers repo roster for @cregx/wim-backup

Forkers

Forkers repo roster for @cregx/wim-backup

Code of Conduct

Please refer to the Code of Conduct for this repository.

Disclaimer

This program code is provided "as is", without warranty or guarantee as to its usability or effects on systems. It may be used, distributed and modified in any manner, provided that the parties agree and acknowledge that the author(s) assume(s) no responsibility or liability for the results obtained by the use of this code.

Made with ♥️