(First version)
(Add details of mounting an image)
Line 14: Line 14:
 
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:
 
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:
  
 +
<PRE>
 
net use z: \\192.168.0.253\Images
 
net use z: \\192.168.0.253\Images
 +
</PRE>
  
 
== Creating an Image ==
 
== Creating an Image ==
Line 20: Line 22:
 
Creating a WIM image can be performed by booting into Windows PE and using the following command:
 
Creating a WIM image can be performed by booting into Windows PE and using the following command:
  
 +
<PRE>
 
dism /Capture-Image /ImageFile:z:\Images\Saturn.wim /CaptureDir:H:\ /Name:"Clean Windows 8 install on Saturn"
 
dism /Capture-Image /ImageFile:z:\Images\Saturn.wim /CaptureDir:H:\ /Name:"Clean Windows 8 install on Saturn"
 +
</PRE>
  
 
== Deploying an Image ==
 
== Deploying an Image ==
Line 30: Line 34:
 
Create a system and windows partition by issuing diskpart.exe the following commands (These commands can be passed to diskpart.exe as a script)
 
Create a system and windows partition by issuing diskpart.exe the following commands (These commands can be passed to diskpart.exe as a script)
  
 +
<PRE>
 
Select disk 0
 
Select disk 0
 
clean
 
clean
Line 40: Line 45:
 
assign letter="W"
 
assign letter="W"
 
exit
 
exit
 +
</PRE>
  
 
=== Apply the image to the windows partition ===
 
=== Apply the image to the windows partition ===
  
 +
<PRE>
 
dism /apply-image /imagefile:z:\Images\Saturn.wim /index:1 /ApplyDir:W:\
 
dism /apply-image /imagefile:z:\Images\Saturn.wim /index:1 /ApplyDir:W:\
 +
</PRE>
  
 
=== Create a basic system partition ===
 
=== Create a basic system partition ===
Line 49: Line 57:
 
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.
 
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.
  
 +
<PRE>
 
bcdboot w:\Windows
 
bcdboot w:\Windows
 +
</PRE>
  
 
=== Reboot ===
 
=== Reboot ===
  
 
Reboot into your newly restored image.
 
Reboot into your newly restored image.
 +
 +
== Mounting an Image ==
 +
 +
WIMs can be mounted with read/write permissions for servicing. Create a mount point directory on your host. In this example, I use the D:\mount mount point
 +
 +
<PRE>
 +
dism /Mount-Image /ImageFile:z:\images\saturn.wim /Index:1 /MountDir:D:\mount
 +
</PRE>
 +
 +
The contents of the WIM should now be present in D:\mount\
 +
 +
Any changes can be committed using:
 +
 +
<PRE>
 +
dism /Commit-Image /MountDir:D:\mount
 +
</PRE>
 +
 +
Alternatively, any changes can be committed and the WIM unmounted using:
 +
 +
<PRE>
 +
dism /Unmount-Image /MountDir:D:\mount /Commit
 +
</PRE>
 +
 +
WIMs can be unmounted and any changes discarded using:
 +
 +
<PRE>
 +
dism /Unmount-Image /MountDir:D:\mount /Discard
 +
</PRE>

Revision as of 10:34, 19 July 2013

Preamble

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.

Mapping Network Drives

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 an Image

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"

Deploying an Image

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).

Partitioning the hard disk

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

Apply the image to the windows partition

dism /apply-image /imagefile:z:\Images\Saturn.wim /index:1 /ApplyDir:W:\

Create a basic system partition

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

Reboot into your newly restored image.

Mounting an Image

WIMs can be mounted with read/write permissions for servicing. Create a mount point directory on your host. In this example, I use the D:\mount mount point

dism /Mount-Image /ImageFile:z:\images\saturn.wim /Index:1 /MountDir:D:\mount

The contents of the WIM should now be present in D:\mount\

Any changes can be committed using:

dism /Commit-Image /MountDir:D:\mount

Alternatively, any changes can be committed and the WIM unmounted using:

dism /Unmount-Image /MountDir:D:\mount /Commit

WIMs can be unmounted and any changes discarded using:

dism /Unmount-Image /MountDir:D:\mount /Discard