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).
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):
- List disk (you should see your USB drive come up in the list; this is the drive # to work with, e.g.,1)
- Select disk 1 (double-check disk number of your USB from the previous command - mine is 1)
- Create part primary
- Select part 1
- Format fs=FAT32 QUICK
- 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.
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 processes.