Windows

What the documentation doesn't tell you about Windows 7 boot media creation

Windows expert Brad Bird discovered an issue that is not fully documented for the procedure of creating boot media for Windows 7. If you've had problems with this, here is his foolproof method of making it work.

I have been working with Windows 7 since the Beta release and now in production. I recently discovered that there is an issue with creating boot media that might give some people trouble. While the procedure is documented both in Microsoft Books (MS Press study guides) as well as in the TechNet Library, it is incomplete and if followed word for word, won't actually allow you to boot to an interface. (For the most part, these same procedures will hold true for Windows Vista, as well as Windows Server 2008, and Windows Server 2008 R2.)

In this post, I'll cover both optical (CD/DVD) media creation as well as USB Flash Drive (UFD) media creation. I'll also list some observations that I've made with regards to UFD media creation.

First, I'll cover the process to create the boot media. If you are creating optical media (CD/DVD), the procedure below is all you need. Later, I'll cover additional preparation steps required to make UFD media bootable.

Since we need an operating system to boot to, we'll use Windows PE. To obtain this, you will need to download and install the Windows Automated Installer Kit (WAIK). Make sure to get the version for Windows 7 and Windows Server 2008 R2. Here is the link for it: http://technet.microsoft.com/en-us/library/default.aspx. The download is a little more than 1GB in size (groan...) so start downloading before bed. My instinct is to say that this will work for Windows Vista and previous versions of Server 2008, but I honestly have not tested this media in those scenarios.

WAIK is available in 32-bit or 64-bit architectures so download and install the one you need for the OS you have installed. Regardless of what version you install, it comes with the files to create boot media for both 32-bit (x86) and 64-bit (x64) versions of WinPE. This is important because if you are deploying a Windows x64 image, you need to boot with x64 media and vice versa for x86 images. Try to remember this fact because, if you boot with the wrong version of media, you won't even see the images you want to deploy.

Once WAIK is installed, launch the shell from: Start Menu | All Programs | WAIK | Deployment Tools command prompt. Running as Administrator will prevent access denied errors (typically errors won't actually say anything as friendly as Access Denied if they come up in a Command Prompt).

Run command (replace x86 for amd64 if you want 64bit):

copype x86 c:\PEBuild 

This will create the directory: c:\PEBuild and copy the required files to get started.

The C:\PEBuild folder is our working space and there will be a couple of sub-directories here.

So far, everything detailed above is written in documentation in the books or on TechNet Library. I have created media about a dozen times and you can use any number of tools to take the contents of the C:\PEBuild\x86 or C:\PEBuild\x64 folder and build an ISO image with them and they will be bootable.

Since we already have WAIK installed, you can use that to create your ISO image by running the command:

ocsdimg -n -b"c:\Program Files\Windows AIK\Tools\x86\boot\etfsboot.com" c:\PEBuild\ISO c:\PEBuild\WinPE.iso

This command will create a 32-bit (x86) bootable winPE ISO image in the C:\PEBuild\ISO folder ,which also gets created with the command. You may need to create the ISO folder under PEBuild.

Now, you could actually boot a system with the ISO like this -- if you were to use a tool,for example, Magic ISO. It would show that the ISO is indeed bootable (my example in Figure A just shows the tool, not a bootable image).

Figure A

What the documentation does not mention for some reason is that you need to copy the winpe.wim file from c:\PEBuild\x86 or c:\PEBuild\x64 to: c:\PEBuild\x86\boot\boot.wim or c:\PEBuild\x64\boot\boot.wim, respectively.

With the file copy, you are also renaming the winpe.wim file to boot.wim. Failure to do this step will cause your boot media to have a fatal error. Think of it like in the MS-DOS days, if you created a boot disk but took out the MSDOS.SYS file. You are effectively booting with no OS to load.

The file copy MUST occur BEFORE you run the oscdimg command above for the media to be usable.

Otherwise, you could use any number of tools to mount the ISO image and copy the boot.wim file to the \boot folder in your mounted ISO; both solutions will work (unless you burned a DVDR...then you are out of luck, and will need to create a new one).

Now that we have a usable ISO image, if a DVDR is what we're after, the job is done. If you want to create UFD media, additional steps need to be performed to prepare the USB stick or drive.

Cautionary Note: The following procedure will erase all data on your key, so take steps to back up anything you want to keep beforehand.

From an elevated Command Prompt (Run As Administrator):

  1. Diskpart
  2. List disk (you should see your USB drive come up in the list; this is the drive # to work with, e.g.,1)
  3. Select disk 1 (double-check disk number of your USB from the previous command - mine is 1)
  4. Clean
  5. Create part primary
  6. Select part 1
  7. Format fs=FAT32 QUICK
  8. Assign
  9. Exit
  10. Voila! Your USB is now prepared.

This is what I usually see...  I don't like to format my keys as FAT32 as I have seen issues where copying large files (more than 1-2GB) fail. For this reason, I prefer to use the NTFS filesystem.

To accomplish this, perform the following changes:

In step 7, format fs=NTFS Quick

That is the only change in the above procedure. You will likely have an issue booting with the key(I always do); however, it's easily overcome.

To fix this issue, do c:\program files\Windows AIK\Tools\PETools\x86\bootsect /nt60 [drive letter of your USB Key] or c:\program files\Windows AIK\Tools\PETools\x64\bootsect /nt60 [drive letter of your USB Key]; an example is shown in Figure B:

This command writes the boot sector to your key to make it start correctly. I have NEVER had the above procedures fail me. One of my colleagues swears he ran into an issue using NTFS on a key and needed to use FAT32, but this is highly impractical on larger keys.

Hopefully this post will prove useful to some of you in deploying Windows 7. Deploying from a bootable UFD cuts install time down to a fraction of deploying from DVD so I use this process often.

About

Brad Bird is a lead technical consultant and MCT certified trainer based in Ottawa, ON. He works with large organizations, helping them architect, implement, configure, and customize System Center technologies, integrating them into their business pr...

13 comments
Gis Bun
Gis Bun

I think Ms. Frye is blowing this out of proportion [not as bad as Steve Jobs thinks the "Antennagate" is but...]. There are multiple ways of creating bootable media. As danweinstein" mentioned 2 USB related products let alone a few others that have cropped up that make USB creating quite easy. These blogs are more for the IT Pro person, so the average person wouldn't even bother with this stuff anyways. I think the consensus from most who used the varios Microsoft deployment tools [WAIK, MDT, etc.] is that they are a hodge-podge of utilities [sort of like using Word to write a book but use another software package to create the index].

marks
marks

Do you really think the average user is going to do this? I hate to think about the new load on the Help Desk if every user is expected to operate at this level of competence.

stjones
stjones

Not much at provided link. Searched and found an ISO image (KB3AIK_EN.iso - no 32-/64-bit distinction). Downloaded and mounted it. Ran install (no 32-/64-bit distinction). Found Deployment Tools command prompt in a different folder. Ran copype command with amd64 which created c:/PEBuild. Went to run ocsdimg command but "c:\Program Files\Windows AIK\Tools\x86\boot\etfsboot.com" doesn't exist (neither does ia64/boot nor amd64/boot). Gave up.

shrinath_m2
shrinath_m2

Why do you need windows AIK ?? All you need to create a win 7 installation flash drive is just a copy of win 7 and usb flash drive. use diskpart to format and make a partition of the usb drive, as a user above commented, use active command, forget everything else and just copy win 7 dvd contents into flash drive. its all ready bootable.. The active command of diskpart is all that is necessary to make the usb drive bootable.

johnbaldwin
johnbaldwin

In your steps to format the USB key, before step 7 when you format it, you forgot to do a "active" command to set the currently selected partition to 'active' - perhaps this is why you need to set the boot command later? We've had no problem booting with USB keys, even formatting them as fat32, but we always do the "active" command before formatting - works on our 32-bit and 64-bit winPE USB keys.

brad
brad

Well, ask an average user what they would do and see what they say. I did before writing this and answers of course vary. Many said I would ask a friend. Others said I would Google Search, etc.

brad
brad

Hi stjones, I am late to the replies here. Please e-mail me at brad@bradbird.ca and I'll help you through.

brad
brad

Hey shrinath, back in the Vista days I used to do it this way so I am sure that it still works. The purpose of my post though was to tie up some loose ends which the current documentation online does not do. Your suggestion is valid but it is 1 possible way to accomplish the same task.

brad
brad

Hi John, I have never actually had an issue not using the active command which is why I omitted it :).

brad
brad

I'll check this out.

brad
brad

Thanks for the heads up on the tool Dan. I did not know about it and neither did many of my peers :). The procedure is still listed in the TechNet Library which is a goto resource for m any ITPROS.