111 - How to semi-automate Windows driver installation

hit counter




If you find that you have to re-install Windows to the same computer or same model of computer several times a year, you may find it worthwhile trying to automate the driver installation by writing a simple batch file.

This means that you can quickly install Windows (e.g. from an Easy2Boot USB drive) and then once Windows has been installed, you can quickly install all the Windows drivers for that system by running the batch file. Normally you will only need to press [Enter] a few times or click a few buttons to install all the drivers using this simple technique.

Tip: To find the silent switches needed for many common installer applications - see here for the USSF (Universal Silent Switch Finder) application.
You can also use the Windows Post Install Wizard if you prefer - see Britec's video here. Also this link here.

Here is what I do.

1. Download all the correct and latest Windows drivers from the manufacturers website.

2. Extract the drivers (e.g. using 7Zip) so that you have the installation files (usually a setup.exe file + other files)

3. Copy each driver onto a USB drive (e.g. an Easy2Boot Windows install USB drive) and give each driver folder a unique and meaningful name:
e.g.
\Drivers\Asus904HA\XP\Audio
\Drivers\Asus904HA\XP\Chipset
etc.

4. Install Windows (XP/Vista/7/8 whatever) onto your target system as normal (e.g. using Easy2Boot)

5. Attach the USB drive that contains the drivers to the target system (the drivers could be on the same Easy2Boot USB drive)

6. Starting with the ACPI driver or chipset driver, run an Administrator command prompt and have a look what type of files are in the driver folder.
  • If you have a Setup.exe file, then type start /wait setup.exe -s

  • If you don't have a Setup.exe but have a .msi file, then type, for example, start /wait msiexec /i "Asus ACPI Driver.msi" /passive /norestart

  • If neither of these exist in the driver folder, look for a .exe file that looks like it will install (e.g. asussetup.exe or AudInst.exe or VGAInstall.exe) and then type start /wait xxxxx.exe
If the driver did not install then try another .exe or look for one of these types of files in a sub-folder.

If necessary, re-arrange the folders or delete unwanted folders to keep them tidy.

Make a note of the command you used that was successful.

If the driver install does start, most will automatically install, however it is important to observe the hard disk activity light (LED) and the command prompt. The 'start /wait' command *should* cause the command to wait until the driver has installed, however, if it does not wait and returns immediately to the command prompt, make a note if the 'start /wait' command did not wait as you will need to put a prompt and a pause in the .cmd file that you will make.

If you are required to manually click a button or press [Enter], etc. then do so to complete the driver installation. If prompted to reboot - say 'NO'.

7. Repeat Step 6 for each driver - make a note of each command line that you used and whether it 'waited' for the driver to install or not.

The order that you install the drivers in is often important. If not suggested by the manufacturer, I use:
  • ACPI\ATK driver
  • Chipset drivers
  • LAN drive
  • WiFi driver
  • Audio driver
  • VGA driver
  • Accessory drivers (e.g. power saving, battery management, hotkey, trackpad, etc.)
8. Now you should have a complete list of all the commands required and whether the 'wait' worked or not.

Create a new text file using Notepad in the folder just above the driver folders (e.g. \Drivers\Asus904HA\XP) called Install_All.cmd

Now edit the new empty batch file using Notepad to automatically install the drivers using your notes as a guide, here is a working example that I use to install all drivers onto my Asus 904HA EeePC.

Notice that I pause after every command just to make sure that the driver installed correctly, however you can omit the pause command except where the command does not wait for the driver install to finish (e.g. in my case the wlan, audio, vga and superhybrid drivers). If you try to start an install before the previous one has finished then that driver install may fail.

pushd %~dp0
cd .\acpi_ATK
start /wait msiexec /i "Asus ACPI Driver.msi" /passive /norestart
popd
pause

pushd %~dp0
cd .\Chipset
start /wait setup.exe -s
popd
pause

pushd %~dp0
cd .\wlan_install_cd
start /wait setup.exe -s
echo press key when install finished!
pause
popd

pushd %~dp0
cd .\LAN\LAN\Atheros
start /wait setup.exe -s
popd
pause

pushd %~dp0
cd .\audio
start /wait setup.exe -s
echo press key when install finished!
pause
popd

pushd %~dp0
cd .\vga\driver
start /wait setup -s
echo press key when install finished!
pause
popd

pushd %~dp0
cd .\suphybridEngine
start /wait asussetup.exe
echo wait for hybrid engine
pause
popd

echo FINISHED!
pause


If a reboot is required before another driver can be installed, then prompt the user to reboot the system using an 'echo' command and use two Install files Install_All_Step1.cmd and Install_All_Step2.cmd.

The next time you install Windows to that model of computer, simply double-click on the appropriate Install_All.cmd file to install all the drivers in just a few minutes.

Tip: save the whole driver folder (or even the whole Easy2Boot USB image) onto a 'cloud' storage area like DropBox or SkyDrive to make recovering from a future disaster less time consuming and traumatic!

There are ways to further automate the driver installs and make them fully automated, however this often takes a considerable amount of time as there are always one or two 'difficult' drivers which won't easily automate and sometimes you need to reboot before the next driver can be installed which further complicates the install process.
Setup.exe -s will use an InstallShield setup.iss file which needs to be present. You can record a new one using setup -r and then go through the install procedure to record your actions into a new setup.iss file.
For .msi files you can use msiexec (see here for more info) with various switches, e.g. add logging or prevent a reboot.

If you include the whole driver folder within your installation files (e.g. in $oem$ folder if installing XP), then the batch file and drivers will all be on the hard disk and will be ready to run as soon as the install has finished.

Search