All spaced out

Well, as this is my first post on my blog I thought I'd use it to share the solution to a problem I had recently so that nobody else needs go through the stress of debugging it!

My current project is to install and configure BDD 2007 so that my client can create images for their standard desktop build.  The build is Windows XP SP2 with all the core applications, i.e. Office 2003, PDF viewer etc.  The problem was that BDD was failing after running, what appeared to be successfully, Sysprep at the end of the reference machine installation.  The error displayed was:

"The HKLM\System\Setup\CloneTag registry value did not exist"

 And, as advised, the key really did not exist.  I had no other errors displayed and if I rebooted the computer manually Sysprep would run normally and the machine would restart into Windows XP.  So, I had an error message which was 100% reproducible, but no symptoms of error on the computer, i.e. mini-setup ran correctly upon restart.

So, dipping into the LTISysprep.wsf script, I removed the '-quiet' parameter from the Sysprep command and relaunched the BDD installation process to see if I would receive any more information.  This gave me a new error message which said:

 "An error occurred while trying to update your registry".

 Well, I knew that already because BDD had told me that the CloneTag key did not exist!  Additionally, this problem only occurred if I used the Sysprep.inf file that the client gave to me from their own installation process.  Any other Sysprep.inf file worked normally, thus meaning that there was a problem in the contents of the clients.  After spending a lot of time with many different combinations of configuration, I asked for help from some other Microsoft BDD experts.  Ben Hunter (thanks again Ben) replied back to me after reviewing the Sysprep.inf saying that the problem was caused by a simple space before and after the equals sign in the following line:

PCI\VEN_8086&DEV_27C1&CC_0106 = %systemdrive%\drivers\sata\iaahci.inf

Low and behold, by removing the space, all worked correctly!  My next question was simple.  If the client has been using the same Sysprep.inf file for a few years, then why have they never experienced this problem before?  And also, why could I find no other documented example of someone with the same problem when I searched on the Internet?  The answer is simple; if there is an error in the Sysprep.inf file then Sysprep will simply ignore the line completely if you have used the '-quiet' parameter.  Seeing as almost everyone uses this parameter, the error occurred silently and never reared it's ugly head.  One further thing, the offending line in the Sysprep.inf file is there so that Sysprep will load the correct drivers for a SATA disk.  Seeing as a large majority of people still use IDE, this line is not required thus reducing the chances of having a line like this in the file.  The strange thing is that other values in the Sysprep.inf file will still work correctly if they have a space before/after the equals sign.  For some reason the section for the mass storage devices is a bit more picky than the rest of the areas!

The solution was simple, but it took quite a few very frustrating hours to find it.