This guide is a step-by-step or a walkthrough to assist you in cloning a Windows 7 machine with all its Windows Updates, Software and settings, so that you can deploy onto another PC/computer without having to sit in front of it and manually install the many software packages one by one. Also if you have download limits with your internet connection like my Dad does, this will save double downloading of the same thing. E.g. Windows Updates and Office Updates.
Tools you will need for this are as follows:
- A WinPE disk with imagex.exe included on it. You can either make this yourself, or download my pre-made Windows 7 WinPE version in ISO format from here. My version is 64-bit, which should be okay as most machines are 64-bit these days. If you want to make this yourself, it’s a bit tricky, you will need the Windows (AIK) Automated Installation Kit and then you follow this guide.
- A Windows 7 installation DVD, either as a hard copy or ISO file. Try to match the version of Windows 7 you have, e.g. Ultimate, Professional, Home Premium or Enterprise. If you are using a physical PC, then you’ll need the hard copy, so if you have the ISO file only, you’ll need to burn this to DVD.
- An alternative form of storage, e.g. external USB drive. This USB drive will need to be fairly large, the same, if not bigger than the C:\ drive of the machine that you want to take an image of. Imagex.exe outputs the image to a .WIM file which is single instance, however you will need enough space, just in case.
- You will need to be familiar with your computer and which function key you need to press at start-up to bring up the different boot options. E.g. some machines require you to hit F12, then this will give you the option of booting from the CD/DVD ROM. Make sure you are familiar with the source and target machine’s boot device start options.
Sysprep source PC
To get the source PC ready so that you can take an image of it with imagex, you will need to sysprep it. In a nutshell, sysprep puts the Windows state one step back in the installation phase without affecting the data or software loaded. This ensures that after you take an image, once you load the image onto other machines, the image will boot more successfully without being dependant on having the same underlining hardware.
- Step one of the systprep process means that you need to get everything ready, complete installing all the applications, download all updates to everything, Windows and Office updates etc. Remove any sensitive information.
- Run Sysprep by running the sysprep.exe file located "C:\Windows\System32\Sysprep\sysprep.exe"
- Choose options as per the image above, and then click OK. Sysprep will take about 5-10 minutes and will shutdown upon competition. When the computer shuts down, don’t power it back up, as you will need to first boot from the CD/DVD ROM using the WinPE CD.
The sysprep log can be found C:\Windows\System32\Sysprep\Panther. After executing sysprep, you might get an error for instance "A fatal error occurred while trying to sysprep the machine", also you might see the following errors in the sysprep log file.
- [0x0f0070] SYSPRP RunExternalDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = -2147024864[gle=0x00000020]
- [0x0f00a8] SYSPRP WinMain:Hit failure while processing sysprep cleanup providers; hr = 0x80070020[gle=0x00000020]
This error can be fixed by stopping and disabling the Windows Media Player Network Sharing Service under services in Windows.
Capture image of the source PC
Next you will want to use imagex and capture an image of the source PC which is in a sysprep state.
- While the source machine is shutdown, plug into the external USB drive.
- Start up the source machine, but make sure you quickly (before Windows loads) hit the correct function key, e.g. F12 which will give you the correct boot device options. You will want to insert the WinPE CD and boot from this device. Note, if you miss this boot device option and Windows starts loading, you will need to let it load fully and restart the whole sysprep process again.
- Once the machine starts booting from the CD/DVD ROM, You will see the message "Press any key to boot from CD or DVD, press any key". Press any key.
- Once WinPE has loaded, you will see just a command prompt window like this.
- From here, navigate to each different drive looking for which drive contains the imagex.exe utility, also the Windows drive that you want to capture. First you’ll need to make note of the drive that contains the imagex.exe utility, start with drive letter c: and work your way up. Below is an example, type in e: at the prompt, hit enter. Then get a directory listing, type in dir and hit enter. You are looking for imagex.exe. Once found, make note of that drive.
- The next drive you will need to make note of if the drive that you want to capture. This is the drive which you have run sysprep against. Again, cycle through the drive letters. For each drive letter, you want to change the directory structure to C:\Windows\System32\Sysprep. To change the directory, run the command cd (change directory), so you would run cd C:\Windows\System32\Sysprep and hit enter. Note, not all drives will have this location, so move to the next drive in this instance. You are looking for the drive which has the file Sysprep_succeeded.tag. Once found, make a note of this drive letter, this will be the source drive letter. In this example, my source drive letter is C:
- Next you will need to cycle through the drive letters once again finding your external USB drive. Tip, you can skip e: drive and c: drive, as you know these are the imagex.exe and source drive respectively. Once you have found the drive letter of the external USB drive, make a note of this as well.
Next, take an image of the source machine.
- Change the drive to the drive which contains imagex.exe, for example, type e: and hit enter. Then enter the following command imagex /capture c: d:\image.wim "ImageName" /compress fast /verify where C: is the source drive and D: is the USB drive.
- Once this has finished, restart the source machine and start it normally.
Apply the image on the target PC
To apply the image on the target machine, it’s mostly the reverse of the previous step.
- While the target machine is shutdown, plug into the external USB drive.
- Start up the source machine, but make sure you quickly hit the correct function key, e.g. F12 which will give you the correct boot device options. You will want to insert the WinPE CD and boot from this device.
- You will see the message "Press any key to boot from CD or DVD, press any key.
- Once WinPE has loaded, you will see just a command prompt window like this.
- Similar to the steps above, cycle through the drive and make note of drive containing the imagex.exe file, your external USB drive and the target drive. Making note of the target drive is a little more complicated, you can use DISKPART to help find it. Run Diskpart at the command prompt by typing diskpart and hitting enter.
After DISKPART loads, type in list vol and hit enter.
You will have a good idea of the target drive by looking at the size column. In my example, my target drive on the target machine is drive c:
Also, while you’re in DISKPART, run the following commands hitting enter after each one to prepare your target drive otherwise after booting from the newly loaded image, it might hang at the stage "Setup is starting services".
- list disk (To list the target disks. Make note of the disk which you want to use as the target OS (operating system) disk)
- select disk 0 (Your disk number maybe different)
- CREATE PARTITION PRIMARY
- format quick fs=ntfs label="OS"
- assign letter="c"
- Exit out of DISKPART by running the command exit and hit enter.
- Apply the source image onto the target machine by running the command imagex /apply d:\image.wim 1 c:\ /verify where d: is your external USB drive and c:\ is your target OS drive.
- Once this is complete, remove the external USB drive and the WinPE CD and shut down the target machine.
Starting up the target machine for the first time
When starting the newly imaged target machine for the first time, you might receive an error "BOOTMGR is missing"
This can be fixed using the standard Windows 7 installation DVD media.
- Boot the target machine from the Windows 7 installation DVD. You might need to choose the boot device by hitting the correct function key, e.g. F12.
- Once the target machine boots from the CD/DVD ROM, a couple of seconds later press any key to boot from the DVD.
- Select the correct Time and currency format, and click Next…
- Choose the option to Repair your computer.
- Let it search for Windows installations
- Once it finds the Windows installation, click Repair and restart.