How To Image, Sysprep and Deploy Windows 7 a Complete Guide – Using sysprep and Imagex

Starting with Windows Vista and continuing into Windows 7. Is the ability to image a machine and to have the Windows installer use that image to install Windows. This negates the need for an image for each hardware configuration. Or the use of any third party software

This guide will show you how to create and image from scratch then prepare it for your domain using sysprep. Then how to install Windows 7 from this image.

Index

Getting Ready
Create WINPE Disk
SYSPREP your machine (For Domains)
Capture the Image
Create new Install Media

Related

How to copy the default profile and setup for domains
How to install Windows 7 from a USB stick using XP
Generate an unattend.xml file for unattended installation
Use WDS for Windows 7 Imaging (New Article)
Get Help in our Forums


Getting Ready

  • Install Windows 7 from scratch on to your test machine. DO NOT upgrade from Windows XP, this needs to be a fresh install.
  • Customise Windows 7 with any software, security settings or general settings you wish. When you install from this image all the settings as well as user accounts will be installed by default.
  • Install WAIK for 7/2008 on the test PC. Download from here (1.7GB).

Create WINPE Disk

  • Right click command prompt run as admin
run as admin
  • Change to directory “C:\Program Files\Windows AIK\Tools\PETools”
  • run command “copype x86 c:\winpe”
petools
  • run command “imagex /mountrw c:\winpe\winpe.wim 1 c:\winpe\mount”
imagex command
  • copy imagex.exe from “C:\Program Files\Windows AIK\Tools\x86\imagex.exe” to “c:\winpe\mount\windows\system32″
copy imagex
  • Create wimscript.ini in “c:\winpe\mount\windows\system32″ with following inside
  • [ExclusionList]
    ntfs.log
    hiberfil.sys
    pagefile.sys
    "System Volume Information"
    RECYCLER
    Windows\CSC
    [CompressionExclusionList]
    *.mp3
    *.zip
    *.cab
    \WINDOWS\inf\*.pnf
    
  • Run Command “imagex.exe /unmount /commit c:\winpe\mount”
imagex command commit
  • Run Command “copy c:\winpe\winpe.wim c:\winpe\iso\sources\boot.wim /y”
  • Run Command “oscdimg -n -h -bc:\winpe\etfsboot.com c:\winpe\iso c:\winpe\winpe.iso”
winpe command
  • This will create an ISO in c:\winpe\winpe.iso.
    Burn this and keep. Now we need to sysprep our machine.
    (You can remove WAIK and any files you don’t need, test your iso first!)

Sysprep Your Machine

  • change to the folder “c:\windows\system32\sysprep\”
change directory sysprep
  • run command “sysprep /generalize /oobe /shutdown”
  • If you want to use run an unattended installation you can run the following command sysprep /generalize /oobe /shutdown /unattend:unattend.xml (The unattend.xml will need to be in the sysprep folder). Check out the unattend.xml generator
  • Sysprep will remove any unique information and reseal the OS. Then the system will shutdown
  • sysprep Windows 7
  • Now boot the ISO we created previously and load into WinPE

Capture Image

  • Once WinPE is booted you will be in a Command Prompt window
  • Run Command “diskpart”
  • Run Command “select disk 0″
  • Run Command “list volume”
  • Note the letter of the drive you are imaging. C:\ in WinPE is set as the running OS not as the internal HDD
  • Run Command “exit”
  • Run Command “imagex /capture d:\ d:\install.wim “My Windows partition”" where d:\ is the drive you are copying
  • This will create a file called install.wim in the root of your HDD. This is the custom image and will need to be added to the Windows 7 Install DVD

Create Installation Media

  • You will probably need to install from USB as the image will probably be to large for a DVD. Here is a guide for Windows 7 USB Install
  • overwrite install.wim to \sources on the windows 7 install source
  • If you didn’t use the sysprep to include unattend.xml you can also add it directly to the root of the install media. You can easily Generate an unattend.xml here
Install.wim windows 7

Install Windows 7 as normal. Your changes will be installed along with Windows 7

Trackbacks

162 Comments (Newest on top)

  1. Rob says:

    ok , thankyou

  2. pathum says:

    Hi Ben,

    I’ve been using an ASUS motherboard (g31 chipset) temporarily as my Intel DP35DP motherboard was on repair. Getting it back tmrw, and i have windows 7 installed on the current board. I don’t want to re-install W7 again once i’ve installed my new board. Will this method also preserve my files in My Documents, Desktop etc? (um a noob to this so appreciate you help)

    • Ben says:

      Windows 7 is not chipset dependant,
      You should be able to replace the mobo and windows will load and detect all the new hardware

      • pathum says:

        Ben,

        Unfortunately i experienced the total opposite. W7 simply refused to boot. It didnt manage to pass the loading Windows logo. :( … good thing i had linux on the other partition. I managed to download the motherboard drivers and i had a backed up image. I used the “image recovery” in the recovery mode to install the motherboard (chipset drivers) and then restore the image. Then used a thirdparty file recovery tool to restore the files deleted by the Image Restore process.

        Btw Ben, is there anyway where i could ONLY backup a SELECTED SYSTEM partition. W7 by default backs-up two SYSTEM partitions on ma PC out of which one has really big files and causes the backup filesize to be HUGE.

        Tnx nyways.

  3. Justin says:

    I’ve done all of these steps with no problems until I try to install on new computer. I have no clue why but when it starts to install, it says “The product key entered does not match any of the Windows images available.” All I can do is hit OK and it goes back to original screen of Windows 7 install.

    I used sysprep, would that be screwing up the key?

  4. Paulo_Cabral says:

    I had the same problem that Justin reported. Do you have any solution yet??

  5. Ben says:

    This most likely means the product key does not match the media.
    There are diffent versions such as oem,open license and retail.