The imaging of Windows based computers can be performed with DISM (Deployment Image Servicing and Management) and a Windows PE Environment (Windows Pre-installation Environment). Both are available as part of the Windows Assessment and Deployment Kit (ADK) for Windows.
DISM can work with two different image types. The Virtual Hard Disk (VHD) was designed for virtualisation and represents the physical disk. Windows Imaging Format (WIM) is a file-based disk image format developed to help deploy Vista and subsequent versions of Windows.
WIM's are the preferred method of imaging. It supports compression, single instancing (only one copy of identical files are captured) and has better support for offline maintenance tasks.
The Windows PE Environment is a lightweight version of windows that can be loaded from removable media. It allows command line executables such as dism.exe to be executed on the host computer. Upon boot-up the C:\windows\system32\startnet.cmd file is executed and can be used to automate the deployment process.
WIM images can be stored on a NAS or network share for ease of backup and recovery. The net command can be used to map network shares within the Windows PE environment:
net use z: \\192.168.0.253\Images
Creating a WIM image can be performed by booting into Windows PE and using the following command:
dism /Capture-Image /ImageFile:z:\Images\Saturn.wim /CaptureDir:H:\ /Name:"Clean Windows 8 install on Saturn"
A WIM image can be applied to the target machine by partitioning and formatting the hard disk drive, restoring (applying) the WIM to the windows partition and creating the boot configuration data (BCD).
Create a system and windows partition by issuing diskpart.exe the following commands (These commands can be passed to diskpart.exe as a script)
Select disk 0 clean create partition primary size=100 format quick fs=ntfs label="System" assign letter="S" active create partition primary format quick fs=ntfs label="Windows" assign letter="W" exit
dism /apply-image /imagefile:z:\Images\Saturn.wim /index:1 /ApplyDir:W:\
Use BCDboot to create a basic system partition for booting. The BCDboot tool will copy a simple set of system files to a system partition. These files include boot configuration data (BCD) information that is used to start Windows.
bcdboot w:\Windows
Reboot into your newly restored image.