Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We're using ImageX to deploy Windows 7 Professional. We've gotten the Windows partition to work, but the recovery partition (100-200MB at the front of the drive in a standard install) isn't as simple.

This TechNet Guide has been useful. That looks like it could work, but would take a lot of time if we need to do that for every single machine we deploy. Is there a faster/automated way?

share|improve this question

I just create a 350MB active partition, and fill the rest of the disk with the other partition. Format the first one with NTFS, install bootmgr and the bcd. Pop the Win7 installation onto the other partition. Then use bcdedit to specify the device and osdevice settings for the {bootmgr} and {default}.

A few more details of how we do an automated deployment of Windows 7. Now bear in mind that we have quite a bit of software that where the installation can not be automated, so most of MS's tools just don't work that well. (I really wish vendors would get with the program, it's not like Windows Installer and the MSI format have been around for a decade; oh wait, they have.) Anyway, most of this is pretty standard deployment stuff.

Make sure you read everything and completely understand what you're going to be doing before you start. Some of the downloads are quite large, but all of them are free.

  1. Build a box with the minimal software installed and updated. Our most recent version has Windows 7, Office 2010, various industry specific programs & tools, as well as a slew of .NET Framework, Visual C++ Runtime, Java, and related things. The last thing to do is run: sysprep /generalize /shutdown (after which the computer will turn itself off).

  2. If you have a copy of WinPE ready to go, skip this step. Download the Windows AIK, and install it. Follow the instructions for making a WinPE image that will work for your environment. The most common setups are Bootable CD, Bootable USB HD, or PXE (You need a TFTP server and DHCP configurations for PXE; WDS is MS's implementation, though 3rd party tools work too). Be sure to copy ImageX (in the Windows AIK folder) and other tools if you want to the WinPE image.

  3. Boot the computer from Step #1 with the WinPE image. You'll need a place to store the image, an external USB HD or network share are usually the best places. You can mount a network share using net use * \\server\share. Depending on the exact configuration your computer might have more than one partition. Run the capture command once for each partition (it's common to have two):

    imagex /capture C:\ Z:\MyImage-C.wim "MyImage"
    imagex /capture D:\ Z:\MyImage-D.wim "MyImage"

    When that's done you've got an image you write to any similar computer. The computers don't have to be terribly similar, but you'll get the best results with similar computers.

  4. Prep the new computer for the image. If you're deploying this to a bunch of computers you'll want to create a custom WinPE image just for writing the image to the computer. That way you can start it and walk away.

    WinPE is a surprisingly simple version of Windows that still has many features. Playing around with it a bit will give you a better idea of how Windows works (it's a similar process for a full blown Windows installation).

    You can write a batch file and place it in Windows\system32\startnet.cmd and it will be run automatically when WinPE boots. Our file has some extra complications as we use USMT to move users' files from one OS image to another, but a simple version could go like this:

    REM You can leave this line out if you don't need the network
    REM Map the network drive where the image lives
    net use Z: \\server\share\images winpe_password /u:winpe_user
    REM Partition the drive
    diskpart /s diskpart.script
    REM Write the image(s)
    imagex /apply Z:\MyServer-BootPartition.wim 1 C:\
    imagex /apply Z:\MyServer-SystemPartition.wim 1 D:\
    REM Fix the BCD
    bcdedit -store C:\boot\BCD -set {bootmgr} device partition=c:
    bcdedit -store C:\boot\BCD -set {current} device partition=d:
    bcdedit -store C:\boot\BCD -set {current} osdevice partition=d:
    REM If you're booting from a USB drive you should uncomment the following two lines
    REM echo All done writing the image.
    REM pause

    The diskpart.script file is in the same directory with the batch script. It's contents are:

    sel drive 0
    create part pri size=350
    format quick
    assign letter=c
    create part pri
    format quick
    assign letter=d

    A quick note, I know that the BCD for our images contains a Windows Boot Loader section named "{current}". If it's different for your install of Windows, then you'll need to change that section. Run bcdedit -enum on the machine during step 1 to see the Windows Boot Loader information and look at the Identifier.

    Almost all of that can be done completely manually if you prefer too. It's easier to fix little mistakes doing it manually; and if you're only doing a computer or two, it'll take less time doing it manually.

  5. When the computer boots up next it'll have a generic WIN-8972345893 name and will not be part of your domain (if you have one), it's pretty quick to rename the computer and join it to the domain; or you can create an unattend.xml file and pass it to sysprep back in step 1. The unattend.xml file can supply quite a few options; it's easiest to use Microsoft's MDT-2010 to author the file.

share|improve this answer
A more detailed one would be great. I've already scripted diskpart to create the 200MB system partition and make the rest of the drive the Windows one. – Jesse K Jun 7 '10 at 17:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.