When trying to clone one computer to different sets of hardware using SysPrep there are a few steps you should take to help clean up the image computer and get it ready for multi hardware setup. I do realize that Vista does not use SysPrep anymore and this is “old news” but I know that it will still be useful to many people out there. Throughout this series I will talk about may parts to SysPrep, not just using it with different hardware, so if you are using SysPrep in your environment it might be a good thing to read over all of this once and see if you can apply any of it to your network.
So without any further ado here we go.
Lets explain how Windows XP and SysPrep interact and how to get them working properly together. Keep in mind that you need to pick and older PC as it is easier to move forward in technologies then it is backwards and that this method works in our scenario but might need further tweaking in your environment.
- Adding Default Windows Drivers
When Windows XP is first installed it has a large resource of drivers on the XP cd to choose from, but when you are SysPreping it no longer has access to these drivers. To resolve this issue we grab a Windows XP cd and copy the i386 folder to our SysPrep folder. Once finished you should have an i386 folder in your sysprep folder containing all the contents of the i386 folder from the CD.
To let SysPrep know that it now has a copy of the i386 directory as a resource we open up our sysprep.inf file and add an “InstallFilesPath” value under the [Unattended] section and set it value to our i386 directory. For my setup I have “InstallFilesPath=C:\sysprep\i386”.
- Folder Structure For New Drivers
How do we install drivers for other computers we have when the hardware is not in our base image PC? We don't need to install them, SysPrep will take care of the new drivers for us as long as we provide the drivers to SysPrep. What we need to do is get a folder structure set up with each of our drivers we need on other computer models and even for the current model. We will need to have a folder for each driver we have and need to keep track of what driver is in what folder. There are many ways you could accomplish this and they would all work as long as you stay within the limits (see below) you can do this however you want.
For our example I will create a 'drivers' folder in the root of the system drive and within this folder create a folder for each driver type, number this folder, and then create another folder within this numbered folder for each driver. Within each folder including the 'drivers' folder create a txt file explaining what each of these numbered folders contains. In my current setup I have a txt file in the drivers folder that let me know folder 1 is video, 2 is network and so on. In the video folder I have another txt file that lets me know what driver is in folder 1, 2, 3 and so on.
This might be a little confusing to look at but there is a reason for this, the OemPnPDriversPath section of the sysprep.inf file can only contain 4096 bytes of data and depending on how many drivers you have you might need to keep the OemPnPDriversPath (see below) paths shorter. There is another way of telling SysPrep what folders to look at but you pick the method that works best for you. There is a very good reason to have each drive in a separate folder but I will go over this in-depth in a later post, just remember you should have one and only one driver per folder in your final setup. (Picking up on my hint?)
- Finding Your Drivers And Getting Them In Your Folders
There are many ways of getting drivers for all your devices and just to keep this short I will not get to in-depth in this post on how to do this. If I have some requests for it I will post in-depth directions latter. I suggest you try downloading your drivers from the hardware manufacturer and extracting the files manually or try using DoubleDriver.
Once you have all these drivers downloaded or extracted we can start putting the in the folders we created earlier. Once they are all in our folders we can create our OemPnPDriversPath section in our sysprep.inf file. This OemPnPDriversPath value should be added to your [Unattended] section of sysprep.inf. This value lets SysPrep know each and every folder you look at during the “Detecting plug and play” section of SysPrep.
This needs to be in a format similar to this:
This is a semicolon separated listing containing each folder that has a driver in it. If you are lazy like me you will find a nifty little tool called PNPPath.vbs that creates this path for you with very little configuration. :)
As I mentioned before there is a second way of doing this and it is with a registry key. This key is called DevicePath and is a Reg_Expand_SZ located at 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion' but yet again if you are lazy like me you will find a program that does this for you as well… Spdrvscn is a small and easy program that you can run to import all these folders into the registry and being as though this key has a 64,000 byte maximum you might decided to use this method over the sysprep.inf method.
Edit (4/16/08): One more important thing about the DevicePath key, make sure you have the right order in this key as sysprep starts with the files folder listed and moves down the list. I just ran into an issue where c:\windows\inf ended up as the first folder and that just blew the clone out of the water. If sysprep finds an old inf in the c:\windows\inf folder it will look for the driver in the c:\windows\driver cache or one of a few other defaults it could pick and will not look at your driver folders. This can cause issues when you have an (an, this that proper?) usb only computer, and the network card is found before the usb devices. When the computer finds the network card and old inf it then prompts for the driver, and since you don't have a mouse or keyboard this ends up just being a mean trick.
Whether you use sysprep.inf or the registry to let SysPrep know where your drivers are remember that you will need to update these values each time you add a new driver.
- Cleanup Cached Drivers In Your Drivers Folder
Before we finish up with our new drivers we need to clean up any drivers that have been cached by a driver search from Windows. When ever Windows searches a folder for divers it creates an infcache.1 file as a sort of index to let it know where drivers are on the next search. These infcache.1 files and can be delete without harm as long as long as they are in this 'drivers' directory and you have not installed hardware from the drivers within these folders.
Running a simple command line is the quickest and easiest way to delete all the infcache.1 files in these driver folders. (replace 'c:\Drivers' with you path if it varies)
del /s /q c:\Drivers\infcache.1 1>nul 2>nul
Now that we have all our drivers ready and cleaned up we can continue on.
Till next time. :)