Modify your Windows installer to support every USB 3 and storage controller Windows 7 ever supported!
The following procedure applies to all versions of Windows XP and newer (at least this is true at the time of writing, which is Windows 11) and can be used to add all kinds of software or features to a Windows installer or Pre-Execution Environment (PE). This capability has been used to bring you famous Windows-based LiveCDs like BartPE and there are numerous scripts, builders and other utilities to make the job easier, some of which I have linked to previously so I can revisit them in detail when I have time.
As I had admitted in the aforementioned article, I've never had to manipulate a Windows Imaging Format (WIM) file before but ironically enough, I have been put in exactly that position today. Windows 7 predates the ubiquity of USB 3.0 by a margin great enough that even the latest releases of its installer do not contain drivers for USB 3.0 controllers: eXtensible Host Controller Interface (XHCI) implementations. Of course, OEMs have always needed to include their bleeding-edge drivers with the versions of Windows that ship with their products. A tool for accomplishing this very easily comes in the form of Deployment Image Servicing and Management (DSIM) which is handily available from the command line in every version of Windows 10 and later, right out of the box. DISM can only work with images of Windows of versions less than or equal to that of the host operating system it runs on.
Although DISM can be used to do much more impressive things, for the sake of brevity this article will limit its focus to adding USB 3.0 and block storage drivers to a Windows 7 installation USB stick - but bear in mind that with just a little creativity you can adapt this procedure to any version of windows on any kind of installation media to produce any kind of highly customized "PE" or bootable Windows environment on (typically) removable storage media. This is also what the Linux &co. world refers to as a LiveCD or LiveUSB, one of the most successful concepts in Information Technology for its applications in diagnostics, testing, repair, forensics, cluster and private computing - to name just a few...
Source Materials: Windows Installation Media
First we need to obtain our installation media. Depending on the version of Windows you wish to work with it may be available for download from the Microsoft website in the form of a direct .ISO image file download, a Media Creation Tool which will facilitate the downloading and installation of a bootable image to a USB stick or burnt to a DVD-R/RW and provide the option of downloading an .ISO image for later recording and/or intermediate modification (kinda like what we're doing now!)
NOTE: Always take special care to run the Media Creation Tool as Administrator! The tool alternates from crashing to working and back again seemingly with each version if you forget to run it as Admin from the top, but only after spending 20 minutes analyzing your existing system...
When Microsoft deep-sixes a product they really go out of their way to make finding it as obnoxious and difficult as possible, typically removing sources one at a time and leaving up many old pages and documents that contain dead links. This is, as far as I am able to determine, the case with Windows 7 which was EoL'd (End of Life'd) January 2020 and has more recently started happening to Windows 8 (though I'm sure everyone's feelings are less mixed here). I don't understand why they have to make such a point of it; they have sophisticated analytics and can tell where people are going on their sites. They know people are looking, they know the links are entirely unnecessarily dead, I don't think it's unfair to assume they are just being pushy dicks.
I would never do that to you, baby :/
In fact I'll do you two better:
- TechBench by WTZ @ https://tb.rg-adguard.net/
- Microsoft Windows and Office ISO Download Tool (Windows-ISO-Downloader.exe) @ HeiDoc.net
If you don't already have an installation DVD, .ISO image file or USB stick/image for older versions (XP through 8) you may need to obtain your installation media surreptitiously. While I have always held that large public trackers with many seeds are not likely to be infested with malware (i.e. picking the best-seeded .ISO on The Pirate Bay) since it would become quite obvious as soon as it was exposed in the comments, likewise it may be difficult to tell thanks to the scores of imbecile commentators misinterpreting antivirus soft-hits and manifold scores more pranksters and trolls making entirely unfounded claims whether to drag a producer through the mud or "just for the lulz," as it were.
Accordingly, when I was left in the same office as a number of authentic, holographically coated and freshly un-shrinkwrapped Windows installation discs one evening I helped myself to painstakingly image and verify them at low speed to form a private collection of air-gapped, trustworthy sources. Should you ever have such an opportunity I highly recommend taking full advantage. Otherwise you will only ever be able to trust your installations as much as you trust whomever you got it from, whomever runs whatever system(s) they resided on or travelled through and that the data has remained uncorrupted whether by time, transmission or malicious third party.
Source Materials: Drivers
The specific reason I'm writing this article is quite likely the same reason you are reading it: trying to install Windows 7 from a USB stick (or a USB optical drive) on a machine that only makes USB 3.x ports available to the user is a dead-end proposition with the stock installation media. One solution is to switch media from USB to DVD, this may not always be possible: many machines (especially subnotebook/ultra-portable laptops, tablets, thin clients and rackmount/blade servers) do not ship with an internal optical drive. On a machine where USB 2/1 ports are also provided it's a simple matter of moving the installation stick or external drive to one of these. Depending on your chipset and BIOS' capabilities it might also be possible to revert all ports to USB 2 functionality by "disabling" xHCI. As Windows 7 will continue to have a harder and harder time finding compatible hardware to be installed on, however, a more permanent solution is highly desirable for those of us in a position where Windows 7 installations continue to happen with some frequency.
That raises another issue: until Sandy Bridge (the third generation of Core iX) Intel did not include an integrated xHCI implementation in its south bridge chips. This necessitated the addition of third party chips (and otherwise contributed massively to the delay of USB 3's widespread adoption). What that means for us is that where UHCI and OHCI compliant architectures could be covered by a single generic driver including full USB 3 support for any possible scenario is going to require sourcing drivers from roughly a dozen different vendors.
That's why most guides like this are happy to assume you are using one of the post-Ivy Bridge chipsets and instruct you to either unpack the Intel® USB 3.0 eXtensible Host Controller Driver for Intel® 8/9/100 Series and Intel® C220/C610 Chipset Family or use the Intel USB 3.0 Creator Utility - which would be swell, if you could still get it. As Dr. Philip Yip "Dell Community Rockstar and Microsoft Windows Insider MVP" (baller swagger. respect.) helpfully explains for us:
The Intel USB 3.0 Creator Utility was a tool for adding USB 3.0 driver support to Windows 7 Installation Media. Intel have been dropped a large number of Windows 7 drivers from their servers now that Windows 7 has reached end of life. The Intel USB 3.0 utility was superseded by the more reliable Windows USB Installation Tool by Gigabyte which despite being Gigabyte branded can be used on up to 6th Generation Intel based hardware from other OEMs such as Dell, HP and Lenovo.
7th Generation Intel based hardware and later are not supported by Intel or Microsoft on Windows 7.
The Windows USB Installation Tool adds only the USB 3.0 drivers and the hotfixes associated for NVMe SSDs. You may need to however Load Intel F6 Storage Controller Drivers provided by your OEM during installation to see the SSD like I did when I tested this on a Dell OptiPlex 7040 and Dell OptiPlex 3040 6th Generation Intel Skylake System with a NVMe SSD...
Storage Controller Drivers! With thanks to the good doctor for bringing us to the second reason I'm posting this article and insisting on going the extra distance here to make a well-rounded, universally awesome Windows 7 Installation medium once, that you will be able to reach for time and time again:
The good news is: we don't have to go hunting down every 15 year old USB 3 and SCSI HBA driver from every defunct and forgotten vendor then unpack (or install and scrape, depending on how obtuse the packager wants to be) each one. Not only does DISM have the ability to recursively scan directories and import any number of drivers automagically, some very wonderful people have done all the legwork for us by compiling gigantic Driver Packs like those for Windows versions XP through 7 found at DriverPacks.net.
Navigate to Downloads > Latest (http://driverpacks.net/driverpacks/latest). For the purposes of this article we're going to focus on Windows Vista/7 (x64) DriverPacks. The USB drivers are contained in the Chipset pack while the storage controllers are in Mass Storage. You may also wish to include the Touchpad_Mouse pack if you have encountered problems using laptop pointing devices before (or plug in a mouse :s).
If your USB stick can support the weight I would strongly encourage you to include the LAN and WLAN packs because Windows 7 support for network devices is severely lacking and this is usually the only driver in the way of setting up the rest of the system after installation. What you need to take into account however is that combined these packs take up almost 1.5GB - and you will have to multiply that by 1+n where n is the number of Windows editions that you will be both supporting on your installation medium and also upgrading to include these drivers.
On my Windows 7 installation USB stick that's four editions: Home, Home Premium, Professional, Ultra. This comes out to roughly 7.5GB of additional space required. Also, depending on how fast your machine is, installing this many drivers to each edition can take a very long time - as you will see the process must be completed from the top, each time, for again: 1+n editions. That being said, if this is going to be your one final installer to love and to hold until death do you part I think, considering how cheap massive USB sticks are these days, I would have a hard time not making the investment right now. IF the stick I am holding in my paw right now were not already brimming with third party drivers and utilities I depend on and a blank stick is a lethally snowy drive away. As always: use your own judgement!
In the opposite direction, you can optimize your driver pack. I took a little extra time and shaved 20MB (roughly 40%) off the Chipset driver pack by deleting all the... chipset drivers; that is: all the drivers for random integrated devices and other miscellany that were not USB controllers, like USB to UART adapters. Combined, my USB and Mass Storage driver pack weighs in at approximately 50MB.
Caveat: Unsigned Drivers
It should be noted that these packs often include drivers for multiple operating systems. For example, the Mass Storage pack I am using contains a directory tree for the SERVER variants of Windows Vista and 7. In particular the Dell PERC hardware RAID controllers are only signed for use on Windows Server. Including them in my Windows 7 installation media may get me past installation but I will have to take additional steps after installation to continue running Windows with critical unsigned drivers. You may be in the same position if you use drivers that, while functional for whatever version of Windows you are using, were never signed for it; whether due to negligence or obsolescence.
If this happens to be the case for you, when you boot into Windows hold down the F8 key until the Advanced Boot Options menu appears. Select Disable Driver Signature Enforcement and continue booting. While this will get you through installation you will either have to do this every time you boot Windows or find a more permanent solution; in the case of a critical system component like a storage controller you have no alternative other than matching the version of Windows you install to the driver that is signed. I don't know about you, but I hate being told how to use my computer. Permanent solutions include:
- Before Windows Vista Service Pack 1 it was possible to simply enter the following at the command prompt:
bcdedit /set loadoptions DDISABLE_INTEGRITY_CHECKS
- You can use either of these utilities: Driver Signature Enforcement Overrider or ReadyDriver Plus (official homepage currently dead, make sure you trust this distributor as I have not vetted them).
- Enable Test Mode. Depending on your version of Windows, perform the most appropriate (and adminny):
- Open the command prompt (cmd.exe)
- Search for cmd.exe, right-click, Run as administrator...
- Windows (Meta) Key + X, click on Command Prompt (Admin) or Power Shell (Admin)
bcdedit /set testsigning on
If you receive an error along the lines of:
- A very involved method that leverages the Windows Driver Kit for Windows 7 (possibly later?) is detailed at https://www.richud.com/wiki/Windows_7_Install_Unsigned_Drivers_CAT_fix. I can not speak to its contused efficacy at the time of this writing.
The value is protected by Secure Boot policy and cannot be modified or deleted.
You must reboot, enter your BIOS settings and forever disable SecureBoot, sacrificing any of the protections it affords.
If, like me, you can not abide the Test Mode watermark (it uglies up our screen shots and at a glance looks like we've done something entirely untoward and out of character, like pirating Windows. The gall.) there are ways of making it walk.
Meat and potatoes time. This is what you need to know:
- On your pristine installation medium, inside the sources directory are the only two files relevant to our needs here: boot.wim and install.wim.
- boot.wim contains the system image that is loaded when booting off the medium and from where the installer is run. Installing drivers here will let you install to devices not initially covered in the officially distributed media.
- install.wim contains the system image(s) that will be installed onto permanent storage, this is the system you will boot into after the installation is complete. Installing drivers here will ensure that your actual Windows installation already has the driver files it needs to function after it has been installed.
- WIM files can contain more than one image, they are addressed by their index number. This is how the multiple editions, if there are more than one, of your version of Windows (i.e. Home, Premium, etc) are rolled into the single install.wim file.
We're going to be doing a lot of mission critical work at the command line so let's make it easy on ourselves and create a simple directory tree for our project, UNIX style: no caps, no spaces, just meaning.
Follow these steps to load the project tree:
- Copy boot.wim and install.wim from the \sources directory at the root of your pristine installation medium to the project directory, right beside the backup, drivers and mount directories.
- Make a second copy of the boot.wim and install.wim files in the backup directory. You are never to modify these files; they are there in case you need to start from scratch or make a new project later - at which point you will copy them from the backup directory into the project directory.
- At this point it is an excellent idea to make a DIGEST file containing one or more checksum hashes of these files so their integrity can be verified at a later date before using them to seed another project and prevent working from a corrupted origin. If you have installed 7zip you likely have the ability to generate checksum hashes from the context (right click) menu inside Explorer. You can also add file hashing options to the context menu using this registry hack on versions of Windows that provide PowerShell.
- Copy all of the drivers you wish to install to your medium to the drivers directory. It is safe to leave them stacked inside their own directory trees (as provided by DriverPacks.net) as we will be taking advantage of DISM's recursion ability.
- Appropriate to your situation, where here we focus on Windows 7, delete any signed drivers that are duplicated between inferior or superior versions of your target. In the driver packs relevant to Windows 7 the only options are ALL, Win7, Vista and SERVER, therefore I simply delete the Vista directory since drivers signed for both versions are in the ALL branch and I am concerned about newer hardware, not older.
- I choose to retain the SERVER branches for those rare cases (a few dozen here) where I would like to install to an old server's RAID controller; I will be fully aware of the situation if it happens and won't need the benefit of an interrupted installation to put me in the correct mindset - but this illustrates a reason why you may wish not to include every unsigned driver you can find.
- The mount directory is going to be our mountpoint for the WIM images; this concept will be familiar to all UNIX-like operating system users. Instead of a drive letter (i.e. A: or C:mounted to a directory of a parent system and are presented as a single coherent system to the user. When an image is mounted to the mountpoint you will be free to browse and modify its contents as you would if it were a regular part of your computer. For that reason caution is advisable; unless you know what you are doing you have the ability to do great harm while an installation image is mounted. Follow the next steps exactly unless you intend to experiment or make modifications beyond the scope of this article.
Everything is in its place. You understand the abstract concepts. Go time:
- Open a Command Prompt as Administrator: press the Windows (Meta) Key and start typing cmd.exe but before hitting enter and after it has self-selected, click on Run as administrator in the right-hand pane of the search panel.
- Change your current directory (working path) from C:\Windows\system32 to C:\project:
C:\Windows\system32> cd C:\project
You will not leave this directory for the duration of the exercise.
- Let's get to know the structure of our WIM files:
c:\project>dism /get-wiminfo /wimfile:boot.wim Deployment Image Servicing and Management tool Version: 10.0.19041.844 Details for image : boot.wim Index : 1 Name : Microsoft Windows PE (x64) Description : Microsoft Windows PE (x64) Size : 985,750,801 bytes Index : 2 Name : Microsoft Windows Setup (x64) Description : Microsoft Windows Setup (x64) Size : 1,072,858,042 bytes The operation completed successfully. c:\project>dism /get-wiminfo /wimfile:install.wim Deployment Image Servicing and Management tool Version: 10.0.19041.844 Details for image : install.wim Index : 1 Name : Windows 7 Home Basic Description : Windows 7 Home Basic Size : 11,710,161,360 bytes Index : 2 Name : Windows 7 Home Premium Description : Windows 7 Home Premium Size : 12,222,587,449 bytes Index : 3 Name : Windows 7 Professional Description : Windows 7 Professional Size : 12,122,886,417 bytes Index : 4 Name : Windows 7 Ultimate Description : Windows 7 Ultimate Size : 12,285,492,779 bytes The operation completed successfully.
We will only be installing drivers to the image at Index 2 (Microsoft Windows Setup (x64)) of the boot.wim file. I would like my installation medium to fully support installing every edition of Windows 7 to ensure I can handle any license sticker I encounter in the field, as such I will be installing drivers to every image (indices 1-4) of install.wim.
- First we will mount the boot.wim image at Index 2:
c:\project>dism /mount-wim /wimfile:boot.wim /index:2 /mountdir:mount Deployment Image Servicing and Management tool Version: 10.0.19041.844 Mounting image [==========================100.0%==========================] The operation completed successfully.
- Then install the driver pack so that our installer can both handle being installed from a USB 3 stick and subsequently install to any supported media controller:
c:\project>dism /image:mount /add-driver:drivers /recurse Deployment Image Servicing and Management tool Version: 10.0.19041.844 Image Version: 6.1.7601.17514 Searching for driver packages to install... Found 239 driver package(s) to install. Installing 1 of 239 - c:\project\drivers\Storage\All\M\ARECA\1\arcvdev.inf: The driver package was successfully installed. Installing 2 of 239 - c:\project\drivers\Storage\All\M\ARECA\1\oemsetup.inf: The driver package was successfully installed. Installing 3 of 239 - c:\project\drivers\Storage\All\M\ASmedia\1\asahci64.inf: The driver package was successfully installed. Installing 4 of 239 - c:\project\drivers\Storage\All\M\Highpoint\1\rr172x.inf: The driver package was successfully installed. .. The operation completed successfully.
- Now we unmount the image to commit the changes:
c:\project>dism /unmount-wim /mountdir:mount /commit Deployment Image Servicing and Management tool Version: 10.0.19041.844 Image File : c:\project\boot.wim Image Index : 2 Saving image [==========================100.0%==========================] Unmounting image [==========================100.0%==========================] The operation completed successfully.
- Now it is necessary to repeat the preceding three steps for every Index (or "Image/Edition") that is to support our driver set post-installation:
c:\project>dism /mount-wim /wimfile:install.wim /index:1 /mountdir:mount c:\project>dism /image:mount /add-driver:drivers /recurse c:\project>dism /unmount-wim /mountdir:mount /commit c:\project>dism /mount-wim /wimfile:install.wim /index:2 /mountdir:mount c:\project>dism /image:mount /add-driver:drivers /recurse c:\project>dism /unmount-wim /mountdir:mount /commit ...
- This is another excellent moment to create a DIGEST file containing checksum hashes of the new files. The DIGEST should be kept with them wherever they go, including on the installation medium. This way it will be possible to check them for corruption at any time down the road on any machine.
- If you are using a re-writable medium such as a USB Stick for your installer:
- Delete the original boot.wim and install.wim files on the installation medium; you were instructed to copy rather than cut these files earlier in the procedure to minimize risks but this requires vigilance that the new files are not copied over and renamed to avoid conflicting with the originals. Additionally, Explorer may complain that there isn't enough free space to write the files before giving you an opportunity to overwrite the originals if they still exist.
- Copy the modified boot.wim and install.wim files (and optionally, DIGEST) to the \sources directory in the root of your target installation medium.
Oherwise, if you are burning an optical disk:
- Using your favourite ISO imaging utility (recommendations available on the Windows Software page at foxpa.ws/windows-software) create an image of your installation disc.
- Replace the original boot.wim and install.wim (and optionally DIGEST) files with those modified in C:\project
- Burn the modified image to disc(s).