Sunday, March 14, 2010

Creating an unattended setup for Windows 7/Vista

OK. So, now I have a method to install Windows 7 from a USB flash drive, but I still have to manually enter the Windows product key, user name, time zone, etc. In previous versions of Windows you got around these prompts by creating an answer file using the deployment tools found on the Windows XP installation CD or downloaded as a separate 1.7MB install.

In Windows Vista/7 the process is a little more complicated. The Setup Manager Wizard from Windows XP that asked you the same basic questions the installer would ask has been replaced by a more flexible tool (the Windows System Image Manager) that gives you more control over the install. Of course more flexible generally means more complex and this is no exception.

So, the steps for creating an unattended install are:
  1. Download and install the WAIK from Microsoft.
  2. Run the "Windows System Image Manager" from your start menu.
  3. Right click on "Select a Windows image or catalog file" in the lower left section of the window and select "X:\sources\install.wim" from your installation media.
  4. Now in the upper right section of the Window right click "Create or open an answer file" and choose to create a new answer file.
  5. The next steps are a little convoluted. First you need to expand out the various "Components" of the Windows Image you opened in step 3 and find the section that contains the setting you want to enter an answer for. For example if you want to pre-populate the product key, computer name, or time zone you can select "_Microsoft-Windows-Shell-Setup_". On the right side of your screen you'll see the setup options you can configure for this component.
  6. Now that you've found the settings you want to configure right-click the component and click "Add Setting to Pass...". No doubt you're wondering which pass you should select. For most of the settings I needed "Pass 4 specialize" was the correct place. However, you'll need to do your own research to determine what the right pass is for your unique scenario. NOTE: Some information on each setting can be obtained by right-clicking the setting itself and choosing "Help...". 
  7. (unfinished)
Click here to download an example of the unattend file you should have at the end of this process.  Note that the product key has been masked with "XXXXX-XXXXX..."  So, you'll need to replace that with your own before you can use the file.

Installing Windows 7 from a USB drive

One day I'm sitting there browsing the web, checking facebook, etc. and Windows comes up and says, "Hey, this beta copy of Windows 7 will expire in about a week". Great... this is just how I wanted to spend my weekend.

Not that I'm unfamiliar with the backup/wipe/reload process, but in the Windows XP days I had a nice unattended install that made the process a lot faster and more painless. However, since Windows Vista and Windows 7 use a new "fancy schmancy" WAIK method my old techniques no longer work.

Now of course I could just format the hard drive and reinstall Windows the old fashioned way - manually enter the product key, user name, time zone, etc., but that's way too easy. Anyone who claims to know me as more than an acquaintance knows that it's hard for me to pass up an opportunity to spend hours engineering a solution that saves 5 minutes. So, here we go...

Since I despise CD/DVD/Blu-Ray burner technology (the failure rate is WAY to high, discs burned on one drive won't read in another, etc.) my first step was figuring out how to install Windows 7 from a USB flash drive rather than a DVD. So, for this project I'll be using this super tiny flash drive from Buffalo. For those who are interested the model number is RUF2-PS16G.  Be forewarned, it's a little hard to find state side.  At the time of this entry GeekStuff4U is one of the few places I've found that sells them.

The steps for installing from a flash drive are as follows:
  1. Create a active, primary, NTFS partition on your flash drive.
  2. Copy the contents of your Windows 7 CD to the newly created partition
  3. Open an administrative console and run "X:\boot\bootsect.exe /nt60 X: /mbr" where "X:" is the drive letter of your flash drive.
  4. Make sure your system BIOS is configured to boot from USB drives.
  5. Boot from the USB drive and enjoy.

In the next post I'll go over how to use WAIK to make the installation run without prompting you for a bunch of information.