Computer Imaging with MS WAIK Tools for Windows 7


HTA Main Screen

Introduction

The Windows® Automated Installation Kit (Windows AIK) for Windows 7 is designed to help IT professionals deploy the Windows® 7 operating system. However, we will only be using a few of its tools to capture (create) fully configured images on a central file store and apply (restore) those images to one or many systems through the network. The processes will use a customized WinPE 3.0 disc to access the image file server and capture or apply images. No software needs to be installed on the file store; it just holds the image files.  Everything is done from the WinPE 3.0 disc (CD or UFD). WinPE 3.0 uses some different commands than earlier versions. Keep this in mind if searching for documentation.  Command lines are in green

Ghost would make an image of a whole disk. WAIK makes images of partitions only.

This has been tested with Windows 7, 32-bit (technician computer) and Windows 7, 32 & 64 bit clients (target computers).

Setup (easy way)
  1. You can download my version of the \iso folder here (354MB)
  2. Unzip the contents to a folder C:\winpe
  3. Skip to step 14.2 below

Setup (detailed BIY, Build It Yourself)
  1. Download WAIK for Windows 7 / Windows Server 2008 R2 - http://go.microsoft.com/fwlink/?LinkId=136976 . Some good info there, but you'll want to come back here. 
  2. Burn the downloaded .iso to a DVD
  3. Install on your technician computer, you may need to copy the install files to the hard-drive to run the StartCD.exe.
  4. You only need to install the “Windows AIK Setup”
  5. On your technician computer, click Start, point to All Programs, point to Windows AIK, click Deployment Tools Command Prompt. The menu shortcut opens a Command Prompt window and automatically sets environment variables to point to all the necessary tools. By default, all tools are installed at C:\Program Files\Windows AIK\Tools.
  6. At the command prompt, run the Copype.cmd script: copype.cmd <architecture> <destination> where <architecture> can be x86, amd64, or ia64 and <destination> is a path to a local directory. I’ve heard that x86 works fine with x64 and amd64 too, so it might be all we need.
    For example, copype.cmd x86 c:\winpe.
    The script creates a directory structure and copies all the necessary files for that architecture.  Change to c:\winpe
  7. I deleted the Asian fonts in c:\winpe\iso\boot\fonts and c:\winpe\iso\efi\microsoft\boot\fonts leaving only the wgl4 (Pan-European) fonts.
  8. Mount the winpe.wim file.
    dism /mount-wim /wimfile:c:\winpe\winpe.wim /index:1 /mountdir:c:\winpe\mount
  9. Using the Dism command with the /Get-Package option to see which packages are installed. 
    dism /image:C:\winpe\mount /Get-Packages
  10. Add packages by using the Dism command with the /Add-Package option. To add the HTA package you need both the language neutral package along with the language specific package. 
    Dism /image:C:\winpe\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\WinPE-HTA.cab"
    Dism /image:C:\winpe\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\en-us\WinPE-HTA_en-us.cab"
    I also added:
    Dism /image:C:\winpe\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-mdac.cab"
    Dism /image:C:\winpe\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-scripting.cab"
    Dism /image:C:\winpe\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-wds-tools.cab"
    Dism /image:C:\winpe\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-wmi.cab"
    Add drivers as appropriate by using the Dism command with the /Add-Driver option. I needed to add a couple NIC drivers that were not natively supported.
    Dism /image:C:\winpe\mount /Add-Driver /driver:C:\test\drivers\mydriver.inf
    More info on adding packages here: http://technet.microsoft.com/en-us/library/dd799244(v=ws.10).aspx

  11.  Now you can add some tools to the image.
    copy "c:\program files\Windows AIK\Tools\x86\imagex.exe" c:\winpe\mount\Windows\System32
    and copy anything else you might want into System32.
    Here I modified c:\winpe\mount\Windows\System32\startnet.cmd to call an HTA application. (to see it click here)
    Added a text file diskpart.txt for use with the menu in partitioning a new disk.
    Also added GimageX (a GUI for imagex) but haven’t needed it yet.
  12. Unmount and commit (save) the image. Important! Be sure all files and windows accessing the mounted directory are closed. (/commit is important or changes/additions will not be saved)
    imagex /unmount /commit c:\winpe\mount
  13. Copy the saved winpe.wim to the iso\sources directory and rename as boot.wim
    copy\winpe\winpe.win c:\winpe\iso\sources\boot.wim /y
  14. You can create an .iso to burn a CD or load the image on a UFD stick (I've had much better luck with a UFD)

    1. To create a bootable WinPE CD .iso:
      oscdimg -n -bc:\winpe\etfsboot.com c:\winpe\ISO c:\winpe\winpe.iso
      Burn the image (Winpe.iso) to a CD-ROM disc.
    2. To create a bootable UFD:
      Delete any files on the USB flash drive.
      Partition and format the USB flash drive:
      At a command prompt, type
      Diskpart
      DISKPART> list disk (this will show you which disk is your USB drive, most likely disk 1) 
      DISKPART>select disk 1 (careful, make sure to select the right disk, this could wipe out your hard drive!)
      DISKPART>clean
      DISKPART>create partition primary
      DISKPART>select partition 1
      DISKPART>active
      DISKPART>format fs=ntfs
      DISKPART>assign
      DISKPART>exit

      DiskpartExample

  15. Copy the files from the \iso folder
    xcopy c:\winpe\iso\*.* f:\ /e/h/f 
    (change f: to reflect your USB flash drive) 
    You now have a bootable USB drive with WinPE and the basic tools you need to start imaging
Bonus

        Included in my version are a few handy applications

        More Apps

Usage
  1. Boot from the USB drive or the CD, the menu should come up after a minute or two. It is a slow boot.
    2.     To skip the menu,  and run these commands from the prompt, changing drive letters as needed. Notes
  1. The most confusing part is keeping track of drive letters and what partition they apply to.
  2. WinPE boots slowly on systems with 1GB or less.
  3. The drive letters change when you run option 2, “Restore from server image”, which runs the diskpart script.
  4. XP is not supported by the included commands. Changing to 2 partitions and skipping the system partition then leaving out the bcdboot step might work.
  5. The image store must be NTFS
  6. The HTA menu could use better error checking

References

  1. Apply Images by Using ImageX - http://technet.microsoft.com/en-us/library/dd744531(WS.10).aspx
  2. Create a custom boot image with WAIK for Windows 7 - https://www.sit.auckland.ac.nz/Create_a_custom_boot_image_with_WAIK_for_Windows_7
  3. How Windows PE Works -  http://technet.microsoft.com/en-us/library/cc721977(WS.10).aspx
  4. Step-by-Step Basic Windows Deployment for IT Professionals - http://technet.microsoft.com/en-us/library/dd349348(WS.10).aspx
  5. Windows PE 2.0 - http://www.svrops.com/svrops/articles/winvistape2.htm
  6. Adding Drivers to WinPE - http://www.windows-noob.com/forums/index.php?/topic/2349-guide-adding-drivers-to-a-custom-winpe-30/
 
Appendix
 
Contents of Diskpart.txt:

select disk 0
clean
create partition primary size=300
format quick fs=ntfs label="System"
assign letter="S"
active
create partition primary
format quick fs=ntfs label="Windows"
assign letter="W"
exit


Disclaimer:
Unless stated otherwise, these pages, the scripts presented and their sources are copyrighted freeware.
You may modify them, as long as a reference to the original code is included in the modified code.
Use these scripts entirely at your own risk.
Many of the techniques used in these scripts, including but not limited to modifying the registry or system fiiles and settings, impose a risk of rendering the OS inoperable and losing data.
Unless you don't mind reinstalling the OS and losing data, make sure you have a tested full backup and the associated restore software available before running any of these scripts.
The author cannot be held responsible for any damage, direct nor consequential, caused by the use of, or inability to use the techniques or programs presented here, nor the programs' sources or part of the sources.
Use of any of the techniques, programs or sources presented here implies agreement with these terms.
All trademarks including but not limited to Microsoft, Windows, NT and Vista are used for identification purposes only and are the property of their respective owners.


Any technical comments or questions about these pages
should be sent to: beissner@bestintexas.com

Design & Presence by Best in Texas Web Services

Document made with Nvu