MAKING WINDOWS7 IMAGES

So you just finished setting up your Windows7 machine just the way you like it. Now that all is good you don’t want to waste another 4 hours next time you want to reinstall everything from scratch. Or maybe you are part of a small start-up where you are the one and only software developer / IT department and would like to replicate this same installation on computers that accompany devices you are manufacturing and selling to customers. Don’t despair this is a guide that uses Microsoft’s WindowsPE (Preinstallation Environment) to satisfy your desires.

Before you start you will need:

  • Item1: Windows 7 installation disk. These are increasingly harder to come by.
  • Item2: 1x WindowsPE bootable USB memory stick (at least 16GiB). See below on how to set up WindowsPE.
  • Item3: 1x empty bootable USB memory stick (at least 16GiB) which will become the back-up “disk”.

NOTE: Make sure both USB memory sticks are formatted with NTFS file system. If they are not and they are formatted with FAT32 FS the maximum file size cannot exceed 4GiB. A Windows install image file is around 4GiB-10GiB so the imaging process will fail.

Backup process:

Ensure that the Windows7 machine has been configured to your satisfaction (i.e. driver and programs of interest installed, bloatware removed, default parameters and settings set etc) then restart the computer and boot off the Windows PE USB stick (Item2).

Once WindowsPE is running execute:

g:\imagex.exe /compress fast /capture d: g:\install.wim "Windows7"

where g:\ drive is the drive assigned to the WindowsPE USB drive and d:\ drive is the drive assigned to the Windows7 installation you want to save.

NOTE: You might need to run a few dir commands to figure out which is which. I usually just try dir c:\, dir d:\ up to dir g:\ and from the directory listing deduce which drive I want to back-up.

The image creation takes about 30-60 minutes depending on how large the installed software on the Windows7 drive is, so be patient. At the end of it, on the WindowsPE USB drive (Item2), you will have a file called install.wim. We will need this a little later.

Next we take the empty USB memory stick (Item3) and make it into a bootable USB device by following the description below. Then we copy all the files of the Windows7 installation disk (Item1) onto it (Item3). Next you will replace the default .wim file found in the sources directory of Item3 with the recently created install.wim file.

When all this is said and done this last USB stick (Item3) will contain an installation kit of Windows7 that if deployed will have all your settings pre-configured. One caveat is that this Windows7 back-up can only be installed on the IDENTICAL hardware it was made on. This doesn’t mean the exact same machine but it does mean the exact same model of computer – all the devices installed on the initial machine need to be present on the machine on which the back-up/restore installation kit will be set-up. If one of the controllers (i.e. a different type of HDD) is different the installation will fail miserably.

How to make a bootable USB memory stick in Windows7:

Insert an appropriately sized (16GB at least) memory stick in a USB port and then run the following commands from a command prompt console (running with Administrator privileges):

diskpart
list disk
select disk 1

[make sure disk 1 is the USB memory stick disk – use the size of the disk as indicator of which disk to select. If you choose wrong you will obliterate your local OS installation]

clean
create partition primary
select partition 1
active
format fs=ntfs

 [we don’t want to format as FAT32 because maximum file-size for FAT32 partitions is 4GiB. In our case the instal.wim file will most likely be larger than that]

assign
exit

At the end of this process you will have a bootable USB memory stick.

How to make a WindowsPE bootable USB memory stick:

Follow the steps above on how to make a bootable USB memory stick. Then copy the files in this archive on it (unarchive the files from the .zip file before copying them over) and you will have a WindowsPE bootable USB memory stick.

If you would like to make your own version of WindowsPE go ahead and follow the instructions on the Microsoft website. Oh yeah now that you are going full bore you will probably want to download Microsoft AIK tools too. Good luck!

After installing the backup image:

Once a backup image is installed you will need to change the product key and authenticate the new installation.

To change the product key start a cmd.exe as Administrator and run:

slmgr.vbs -ipk [PRODUCT-KEY]

After about 1 minute the OS will display a pop-up informing you the product key has been successfully changed.

To authenticate use the same command prompt and run:

slmgr.vbs -ato

That’s all.