Note that what you ask (remove all drivers from an image, including the setup image, and then install new drivers) is something Windows 7 does automatically already unless you are deploying an image with the PersistAllDeviceInstalls
in the unattend.xml. However, what I think you're asking is if you can provide drivers to Windows, while a machine is being installed, that Windows will then (hopefully) use instead of ones shipped on the DVD. The answer is yes you can, but it's not without a bit of work on your part. You have two "good" options and one "less than supported, but might work" option, listed below:
One, you can stage drivers beforehand
onto the system so that Windows searches them (and hopefully installs them, if they're appropriate) as part of the normal PnP driver detection process during Windows setup. Unless you're using a tool that knows how to do this when creating images of Windows that you can use to install onto client machines (like MDT 2010 or SCCM 2007), however, this isn't necessarily something you'd want to do manually unless you are not one that is faint of heart. Note that driver injection is the "proper" way to do it as per Microsoft, as these drivers persist for the lifetime of the machine in the device store (just like Windows inbox drivers that ship on the DVD), rather than just being available during setup.
Two, you can also use DriverPaths
as part of your sysprep/unattend.xml process, which is the equivalent of the old OemPnPDriverPaths
option in XP's unattend. However, these drivers are not all staged and added to the Windows driver staging area, they are only available during setup. What this means, in an example nutshell, is that if a user were to add to the system one of the devices you have included drivers for (in DriverPaths during setup) at a later time after setup has completed, the user would then need the driver files to install the device. If the drivers were staged during setup, however, the driver would have been included with your Windows installation, and the device would install without any further user interaction. You would also have to use the DevicePath
registry value (and set up a driver folder on the system containing the drivers you want to include) to "emulate" the staging functionality. This is not exactly what it was intended for, but it's close, and it does work. It's just much more work for you, the one building the images and/or the machines to be installed.
There, there are non-Microsoft tools, like DriverMagician, that can get the installed drivers from a running machine and place them in a folder for you to accomplish either one or two above - or if you wish to pay for a non-free version, create an .exe that will install those drivers for you like any other application. I don't generally recommend installing drivers from compiled .exe files this way in any medium or large-scale way, and I've learned that from experience (note Microsoft recommends #1 and still allows #2, but doesn't have any tools that do this #3 .exe installation for good reason). However, it is an option, so I figure I'll throw it out there.